TIP: Click on subject to list as thread! ANSI
echo: tuxpower
to: Ben Ritchey
from: andrew clarke
date: 2016-05-24 04:39:50
subject: Favs

23 May 16 12:54, you wrote to Wilfred Van Velzen:

 BR>>>>> Ok, here's a good one, what is your favorite Bash script?
 WV>> What kind of answer did you expect? ;)

 BR> Really? Ok, here's my fav, renames EVERYTHING from current folder
 BR> recursively to lowercase:

Strictly speaking this can be simplified to your one-liner command though,
which isn't bash-specific.

 BR> find ./ | sort -r | sed 's/\(.*\/\)\(.*\)/mv "\1\2"
"\1\L\2"/' |sh

On some systems the "sh" command is not necessarily bash, eg. in
Ubuntu it's dash, on FreeBSD it's FreeBSD's sh.

Usually when people refer to bash scripts what they really mean are sh
scripts, or scripts that will run under a POSIX 1003.2 compliant shell, of
which bash is one.

It's usually a good idea to avoid using bash extensions in scripts.
Fortunately this isn't common.

csh (and tcsh) is another beast entirely and isn't POSIX 1003.2 compliant.
I prefer tcsh (vs bash) as a command interpreter, but any shell scripts I
write will be for /bin/sh.

Lastly, you might find that if your shell scripts ever begin to get
complicated you'll want to rewrite them in a more suitable language (Python
is common). Robust sh scripts tend to be difficult to understand and debug
when there's a lot going on, and can fail in strange ways...

--- GoldED+/BSD 1.1.5-b20160201
* Origin: Blizzard of Ozz, Melbourne, Victoria, Australia (3:633/267)
SEEN-BY: 633/267 712/848
@PATH: 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.