Linux Online
[ Register ]

[ Applications ]
[ Documentation ]
[ Distributions ]
[ Download Info ]
[ General Info ]
[ Book Store ]
[ Courses ]
[ News ]
[ People ]
[ Hardware ]
[ Vendors ]
[ Projects ]
[ Events ]
[ User Groups ]
[ User Area ]

Beginning Linux Programming

[ About Us ]
[ Home Page ]
[ Advertise ]

Tips: Shell Programming

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 ]




Comments: feedback (at) linux.org
Advertising: banners (at) linux.org
Copyright Linux Online Inc.
Compilation ©1994-2008 Linux Online, Inc.
All rights reserved.