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

#!/bin/sh
TARGET_DIRECTORY=~/workspace/p1k3/unpublished-archives/wip
show_help () {
cat<<DOC
wip: moves a file to ${TARGET_DIRECTORY}/[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 "$@"