47 Comments
- OpenFuture, on 11/27/2007, -1/+18Dugg for the hilarious pun.
- rupertmorris, on 11/27/2007, -0/+13The common user, if curious, will sate their curiosity and in the process, become a more advanced user.
Scripting isn't insurmountably difficult. And the fact that all it requires is a text editor and a terminal makes the knowledge practical and utilitarian. - SteveMax, on 11/27/2007, -0/+6Good read for people new to the shell. Just remember, bash is the default shell on OS X too, so all of this also applies for Macs*
*= extra software from Fink might be needed. - kd1s, on 11/27/2007, -1/+6I'm a Q&D BASH scripter. I can do things with < 10 lines of code to automate common processes, like shifting files around, etc.
But this was an interesting read. - shinythings, on 11/27/2007, -0/+3So...you are telling me that you can automate things by writing..what did you call them? scripts? I give that a 100 on the no-*****-o-meter!
Still, good for the n00bs out there. If only we could give half Diggs. - init100, on 11/27/2007, -0/+3We have more modern and functional tools for scripting, such as Perl and Python. Bash is the choice for simple scripts, but anything even moderately complex is better done in Perl or Python.
- init100, on 11/27/2007, -0/+2Let me guess: You are running Windows and don't want to install Linux? There is a solution for you, called VMware Player. Download and install it (it's free (as in beer)), and download one of the many virtual appliances that they have available (also for free). Then you can run Linux in a virtual machine on your Windows desktop. It's perfect for trying it out if you feel that you are not ready to install it for real yet.
http://www.vmware.com/download/player/
http://www.vmware.com/appliances/ - Shootfast, on 11/27/2007, -0/+2I'd love to be able to learn more of these kind of things, however lacking a suitable environment to tinker with them is a bit of a problem. A great tutorial nonetheless!
- subgeniusd, on 11/27/2007, -1/+3Why digg down a solid point? This jumps right back into the tired old arguments about Linux being only for the "worthy" and screw you if you won't devote 6 months to learning intricate scripting code.
- init100, on 11/27/2007, -0/+2Not that I know of. I'm not sure in what way that would be an improvement though. Python is a good scripting language, but it isn't a CLI shell.
- tech42er, on 11/28/2007, -0/+1What ***** are you talking about? How is learning about bash not 'learning *****'?
- Misesean, on 11/28/2007, -0/+1Nah...noobs are you guys that "had to learn *****" on Linux
- tech42er, on 11/28/2007, -0/+1Bash has a POSIX-compliant mode. It's not that bad. Though, if you want compatibility, it's not a bad idea to just use sh.
- tech42er, on 11/27/2007, -0/+1Bash is not that ***** hard. The syntax is more cryptic than python or C, but it's not impossible.
- tech42er, on 11/27/2007, -0/+1Look, some of UNIX's (and Linux's) greatest strengths are scripting, pipes, and the filesystem. You're right that most Ubuntu users won't be writing bash scripts, but that doesn't matter. It's still one of Linux's greatest strengths. You're also correct that Linux is also the popular open source operating system, though, and a lot of people use it not because they love UNIX-like OS's (like me) but because hey just want a free, open-source alternative to a proprietary OS. Nonetheless, you can't discount Linux's more technical strengths. And simple scripting is not that difficult if you can use the command line.
- Barbosa, on 11/27/2007, -1/+2speak for yourself I'm not a loser and I understand this and more... and i hope to continue learning more
- heavyal, on 11/27/2007, -0/+1dugg for 'old hacks'. Something I can relate to!
- Shootfast, on 11/28/2007, -0/+1Actually I've happily been using linux for a few years. I just don't have too many things to do that require bash scripts :P
- tech42er, on 11/27/2007, -0/+1Q&D?
- pllb, on 11/27/2007, -0/+1noobs today have it so easy...years back people who used linux actually had to learn *****. I miss those days....
- Wargalas, on 11/28/2007, -0/+1searching through files with vi is idiotic, use grep.
- pllb, on 11/28/2007, -0/+1I'm referring to the people complaining about having to read this or why they have to or saying it's useless etc etc.
- cmdrNacho, on 11/27/2007, -0/+1If they know shell users why the hell would you put this article on 5 different pages...
- bmartin, on 11/27/2007, -0/+1A tip for new scripters out there: It's advisable to use $(command) in favor of `command` for evaluation. The reason being is that when nesting commands (in complex evaluations), it's must easier to write something like $(command1 $(command2)) than to try to nest commands surrounded by back tics.
It's also much more noticeable to someone when typing things on a forum, in case they type the line in instead of copying/pasting. Sometimes users read the line and think `command` is 'command', which is interpreted quite differently. - taphagreg, on 11/27/2007, -0/+1History mainly. BASH was built before that was CPU and memory available to do anything else. Plus, there weren't even that many programmers to help.
If you don't like BASH, try looking at some of earlier shells and you might be grateful. - vuke69, on 11/27/2007, -1/+2It's easy if you have half a brain, and actually put some effort into it.
But we can't have that, now can we?
***** luddites. - arizonagroove, on 11/27/2007, -0/+1Or from MacPorts.
- bmartin, on 11/27/2007, -1/+1Searching through files with VI is slow. An expert scripter uses sed and tee for script editing, so as to never deviate from working in the terminal.
- cantormath, on 11/27/2007, -1/+1Who is gonna learn anything about linux starting with VMware?......
- inactive, on 11/27/2007, -1/+1Well, I would say the real Luddites are the ones who refuse to learn a real language like perl or python and persist in writing complex scripts that push bash/sh way beyond its meagre limits.
- subgeniusd, on 11/27/2007, -1/+1You and all 1,500 members of the "elite". Steve Ballmer misses those days too.....
- yeti22, on 11/27/2007, -0/+0This seems like a decent intro to bash scripting, but I have to quibble with their example. When resizing an image, convert (part of ImageMagick) preserves the aspect ratio. No need for portrait/landscape detection, just call 'convert -resize 365x365' for every image. Which reduces their fancy script down to a three-liner.
Scripting is useful to know, but even more useful is knowing what doesn't need to be scripted. - subgeniusd, on 11/27/2007, -1/+1Has anyone put together a Linux Python shell that would completely replace Bash? With all functions intact? I took an intro to Python course and like it a lot but never read anything about an actual Linux shell replacement. Imagine how much easier newcomers would have it without having to wrestle with Bash.
- subgeniusd, on 11/27/2007, -1/+1The syntax is so convoluted it's like needing to learn Klingon to carry on a basic, routine conversation(ie simple function/work). Why can't Linux use something modern and functional like ----PowerShell------?
- jonathankimmm, on 11/27/2007, -1/+1I smell a movie in the making..........
- schestowitz, on 11/27/2007, -4/+3> Why digg down a solid point?
There's a group that mods down all my comments systematically by its own admission (a 'shoot the messenger' tactic). - rnnbob, on 11/27/2007, -4/+1MILK IS GOOD 4 U.
- OrangeTide, on 11/27/2007, -5/+2Please use a standard shell like bourne shell or korn shell. Or something that emulates them correctly according to POSIX (I like zsh). Bash has too many funny extensions that cause annoying bugs in your scripts if you try to use them on an OS that isn't GNU-centric. There is only one bash but there are plenty of POSIX conforming /bin/sh implementations (bash is not one of them)
- inactive, on 11/27/2007, -4/+1Better still, teach people to use a real language like perl or python. Nobody should be writing anything new in bash/sh these days. There are so many better alternatives.
- inactive, on 11/27/2007, -7/+3Ubuntu FTW!
- wiz0rian, on 11/27/2007, -7/+3Nothing new.. quite boring
- baharlou, on 11/27/2007, -6/+0Nintendo wii anyone?
- CaptainCyanide, on 11/27/2007, -15/+9Buried, for the stupid pun.
- schestowitz, on 11/27/2007, -11/+4"Now that we've brought you to the dark side, it's time to show the true power of Linux - scripting. "
This may be very true, but it also assumes a certain level of knowledge and computer literacy. Thw power to the common users come from front ends that are built on top of (or wrap around) the underlying system calls, which are scriptable. Backups programs are a good example. - KyjL, on 11/27/2007, -11/+4I pose a question for bash scripting:
WHY THE HELL IS EVERYTHING SO CRYPTIC AND ARCHAIC?
bash is great as a CLI but it's a ***** BITCH AND A HALF for cooking up scripts with. What, did they intentionally make it so that nobody but losers like us can understand this *****? - liquidhalcyon, on 11/27/2007, -9/+1I thought someone was writing a movie script from bash.org quotes until I RTFA.
- RAEP, on 11/27/2007, -10/+1Thought this had something to do with bash.org
Failure.


What is Digg?