Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
545 B

#!/bin/sh
show_help () {
cat<<DOC
yank: stashes a file or directory for moving with unyank
USAGE:
yank path_to_yank
EXAMPLE:
yank random.txt
cd ~/notes
unyank
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'; unyank to move to cwd"
}
main "$@"