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
542 B

6 years ago
  1. #!/bin/sh
  2. show_help () {
  3. cat<<DOC
  4. yank: stashes a file or directory for put or put-mv
  5. USAGE:
  6. yank path_to_yank
  7. EXAMPLE:
  8. yank random.txt
  9. cd ~/notes
  10. put-mv
  11. DOC
  12. }
  13. main () {
  14. if [ $# -eq 0 ]; then
  15. echo "No path given to yank."
  16. echo
  17. show_help
  18. exit 65
  19. fi
  20. # Here we get the real path, chop the newline off the end, and stash.
  21. yanked_path=`realpath "$1"`
  22. yanked_path=${yanked_path%\\n}
  23. echo "$yanked_path" > ~/.yanked_file && echo "yanked '$yanked_path'; put to cp, put-mv to mv"
  24. }
  25. main "$@"