bash
'bash' stands for Bourne Again Shell and is the most widely used
shell on Linux systems.
change filename case
If you have files in directory whose names are all in upper case and you
want to change them to lower case, you avoid having to do this
by hand (mv FILE file) with this simple script:
#!/bin/sh
for a in *; do
mv $a `echo $a |tr [A-Z] [a-z]`
done
change file extension
The following short script will change all the
files with extension *.dat to *.txt
#!/bin/sh
for file in *.dat ;
do mv $file `echo $file | sed 's/\(.*\.\)dat/\1txt/'` ;
done
[ return to main tips page ]
|