Created
October 8, 2013 11:07
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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