Skip to content

Instantly share code, notes, and snippets.

@nobucshirai
Last active December 24, 2015 23:49
Show Gist options
  • Save nobucshirai/6883027 to your computer and use it in GitHub Desktop.
Save nobucshirai/6883027 to your computer and use it in GitHub Desktop.
A wrapper script of mv command to add a prefix to a file name.
#!/bin/bash
# $Id: prefixer.sh,v 1.1 2013-10-04 13:34:41+09 shirai Exp shirai $
ArgFile=$1
prefix=$2
main(){
check_args $@
mv -vi $ArgFile ${prefix}${ArgFile}
}
check_args(){
if [ ! -e "$ArgFile" ];then
echo " Usage: $0 filename prefix (default prefix=\"_\" )"
exit
elif [ "$prefix" = "" ];then
prefix="_"
fi
}
diae(){
echo $@
$@
}
main $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment