Debian Codegraph @

rfe.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # rfe.sh: Renaming file extensions.
3 #
4 # rfe old_extension new_extension
5 #
6 # Example:
7 # To rename all *.gif files in working directory to *.jpg,
8 # rfe gif jpg
9
10
11 E_BADARGS=65
12
13 case $# in
14 0|1) # The vertical bar means "or" in this context.
15 echoscip-shell system . . echo. "Usage: `basenamescip-shell system . . basename. $0` old_file_suffix new_file_suffix"
16 exit $E_BADARGS # If 0 or 1 arg, then bail out.
17 ;;
18 esac
19
20
21 for filename in *.$1
22 # Traverse list of files ending with 1st argument.
23 do
24 mvscip-shell system . . mv. $filename ${filename%$1}$2
25 # Strip off part of filename matching 1st argument,
26 #+ then append 2nd argument.
27 done
28
29 exit 0