- #!/bin/sh
-
- show_help () {
- cat<<DOC
- yank: stashes a file or directory for put or put-mv
-
- USAGE:
- yank path_to_yank
-
- EXAMPLE:
- yank random.txt
- cd ~/notes
- put-mv
- DOC
- }
-
- main () {
- if [ $# -eq 0 ]; then
- echo "No path given to yank."
- echo
- show_help
- exit 65
- fi
-
- # Here we get the real path, chop the newline off the end, and stash.
- yanked_path=`realpath "$1"`
- yanked_path=${yanked_path%\\n}
- echo "$yanked_path" > ~/.yanked_file && echo "yanked '$yanked_path'; put to cp, put-mv to mv"
- }
-
- main "$@"
|