#!/bin/sh TARGET_DIRECTORY=~/p1k3/archives/wip show_help () { cat<<DOC wip: moves a file to ~/p1k3/archives/wip/[new_name] USAGE: wip file_to_move new_name EXAMPLE: wip 12 bad_poem_about_marmots DOC } main () { if [ $# -eq 0 ]; then show_help echo # got no arguments echo "existing work-in-progress files:" ls -l "$TARGET_DIRECTORY" exit 0 fi target_file="$TARGET_DIRECTORY/$2" if [ -f $target_file ]; then echo "$target_file already exists" exit 3 fi echo "moving $1 to $TARGET_DIRECTORY/$2" mv -- "$1" "$TARGET_DIRECTORY/$2" } main "$@"