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.

38 lines
611 B

  1. #!/bin/sh
  2. TARGET_DIRECTORY=~/p1k3/archives/wip
  3. show_help () {
  4. cat<<DOC
  5. wip: moves a file to ~/p1k3/archives/wip/[new_name]
  6. USAGE:
  7. wip file_to_move new_name
  8. EXAMPLE:
  9. wip 12 bad_poem_about_marmots
  10. DOC
  11. }
  12. main () {
  13. if [ $# -eq 0 ]; then
  14. show_help
  15. echo
  16. # got no arguments
  17. echo "existing work-in-progress files:"
  18. ls -l "$TARGET_DIRECTORY"
  19. exit 0
  20. fi
  21. target_file="$TARGET_DIRECTORY/$2"
  22. if [ -f $target_file ]; then
  23. echo "$target_file already exists"
  24. exit 3
  25. fi
  26. echo "moving $1 to $TARGET_DIRECTORY/$2"
  27. mv -- "$1" "$TARGET_DIRECTORY/$2"
  28. }
  29. main "$@"