Skip to content

Instantly share code, notes, and snippets.

@nobucshirai
Created October 8, 2013 11:07
Show Gist options
  • Save nobucshirai/6883069 to your computer and use it in GitHub Desktop.
Save nobucshirai/6883069 to your computer and use it in GitHub Desktop.
A wrapper script of mv command to change an extension of a file.
#!/bin/bash
# $Id: suffixer.sh,v 1.1 2013-10-04 13:34:41+09 shirai Exp shirai $
ArgFile=$1
suffix=$2
main(){
check_args $@
mv -vi $ArgFile ${ArgFile%.*}.${suffix}
}
check_args(){
if [[ ! -e "$ArgFile" && "$suffix" != "" ]];then
echo " Usage: $0 filename suffix"
exit
fi
}
diae(){
echo $@
$@
}
main $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment