

Bash-Fu - mrleinad
http://bash-fu.com/

======
billybob
You know, I work at the command line all day, and I'm always happy to learn a
new trick. But for writing actual scripts, I'd much rather write in Ruby. I
don't want to have to use awkward syntax like case statements ending with
"esac."

Yes, using Ruby introduces a dependency beyond Unix. But I already use lots of
libraries (Rails, Rspec, etc) and tools (ImageMagick, Ghostscript), so I don't
see that as a problem, just part of the job.

~~~
wladimir
Indeed, I've long ago adopted the convention to do any remotely advanced
scripting in a "real" scripting/programming language (myself, I use Python for
this).

Bash scripting is good for running a few commands in a sequence, but in my
experience gets unmaintainable and unreadable very quickly, especially if you
try to do sane error handling/logging, or operations on non-text data.

~~~
billybob
Agreed. Although I should add that it's still great to call out to the
standard Unix toolset when it's the easiest way to get something done. The
accepted answer here illustrates that:
[http://stackoverflow.com/questions/4714043/what-is-the-
best-...](http://stackoverflow.com/questions/4714043/what-is-the-best-way-to-
sort-30gb-of-strings-with-a-computer-with-4gb-of-ram-usin)

------
obiterdictum
What does this minimalistic page offer except links to (already) rather well-
known Bash resources? Am I missing something?

~~~
piramida
The bash-fu is weak within that site.

------
BrandonM
I'll use command lines like that when I just need to get something done (after
verifying that there are no files named "foo.sym"), but to write a script that
uses a hard-coded filename that could stomp on other files is pretty bad. If
you have a symlink foo and a file foo.sym, you've just erased foo.sym. The
script also leaves all the .sym symlinks behind; it's not clear that this is
the desired behavior.

If you're going to make a site and call it bash-fu, shouldn't you make sure
your bash is at least good?

~~~
saurik
I was also really bothered that the script failed to handle filenames that may
contain spaces correctly.

~~~
BrandonM
Good catch.

------
limmeau
Exercise: make repl_links.sh work also when filenames contain blanks.

------
gtani
<http://www.deer-run.com/~hal/UnixCommandLineKungFu.pdf>

<http://eriwen.com/bash/effective-shorthand/>

<http://apenwarr.ca/log/?m=201102#28>

[http://stackoverflow.com/questions/68372/what-is-your-
single...](http://stackoverflow.com/questions/68372/what-is-your-single-most-
favorite-command-line-trick-using-bash)

[http://stackoverflow.com/questions/211378/hidden-features-
of...](http://stackoverflow.com/questions/211378/hidden-features-of-bash)

------
fjarlq
What's up with the difficult colors? I'm using Chrome 10 beta on OS X 10.6.

<http://i.imgur.com/ya8WI.png>

~~~
magicofpi
That's strange. It looks fine on FF4 using Snow Leopard.

<http://d.pr/LXvR>

~~~
tygorius
I think it was a reference to the color scheme in the screen shot, not to the
site itself. I find choices like dark blue and brown against black to be hard
to read.

~~~
wtallis
You've probably got a low-quality LCD with a bad color calibration, then, or
else just a really bad contrast ratio or lots of glare. That color scheme
doesn't seem to me to have any colors that would clash, even to colorblind and
partially-colorblind people. Sure, it's a relatively low-contrast color
scheme, but I think it would be generally harder to read if the contrast were
really high. You shouldn't use much in the way of full-intensity colors when
you have a black background.

------
lamby
More like POSIX shell fu - the example doesn't actually use any Bash-specific
features.

~~~
kree10
Seeing #!/bin/bash is one of my pet peeves.

If it's a straight shell script, use "#!/bin/sh" please. If the script
actually requires bash features, I'd appreciate "#!/usr/bin/env bash" because
if I choose to install bash, it probably won't be in /bin.

