Re: [Linuxcommand-discuss] Greetings & a Script
Brought to you by:
bshotts
|
From: William S. <wes...@co...> - 2002-08-27 02:33:23
|
On Monday 26 August 2002 10:16 pm, Bruce Burhans wrote: > > #!/bin/bash > > > > old=$1 > > new=$2 > > > > for i in *$old; do > > k=$(basename $i $old) > > mv $i $k$new > > done > Will give it a try, Bill........But will it skip over > files that do not have the old extension? I think so. The wildcard expansion in the "for" command should only include files that end with the old extension. > Here's one that I use all the time.....I call it fe for > "file explorer"...... > > There are actually two- the main one puts the $PWD > in a temp file in my $HOME when I choose EXIT, > then . dc (that's a dot and a space for 'source' ) cds > me to that directory . > > > > ----------------------------------------------------- > > > #!/bin/bash > ###2.05 > ### fe > while : ; do > select fname in $HOME / EXIT $(ls -aF) ; do > if [ "$fname" = EXIT ] ; then > echo "$PWD" > /home/farley931/.t2 > exit; fi > if [ -f "$fname" ] ; then > less "$fname" > elif [ -d "$fname" ] ; then > cd "$fname" > echo "$PWD" > break > fi > done > done > > ---------------------------------------------------------- > ### dc > cd $(cat /home/farley931/.t2) > > -------------------------------------------------------- One weird script at a time, man ;-) -- ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org |