Explore some of the more useful but perhaps more esoteric capabilities of the Bash shell with the blog post Ten More Things I Wish I'd Known About bash. It is a followup to the highly visible post by the same author on Ten Things I Wish I'd Known About bash. Modern shells like Bash, Ksh, and Zsh have over four decades of developent and refinement, making them powerful, flexlble, and fast user interfaces for efficient work — not just excellent scripting languages for automation.
(Score: 2) by PiMuNu on Tuesday January 23 2018, @10:52AM (21 children)
...ten more things it is easy to do in any modern scripting language; but you never even considered trying in bash (or any shell script).
(Score: 5, Insightful) by turgid on Tuesday January 23 2018, @11:08AM (7 children)
"Gluing things together with a shell script is the Unix way." Gilmour/Waters.
I refuse to engage in a battle of wits with an unarmed opponent [wikipedia.org].
(Score: -1, Offtopic) by Anonymous Coward on Tuesday January 23 2018, @12:04PM
do you know de wey
(Score: 1, Interesting) by Anonymous Coward on Tuesday January 23 2018, @01:46PM (5 children)
I have yet to see any significant software that is the product of unix processes glued together by shell code; it's only been things like configuration scripts or for interactive, "exploratory" programming.
If you wanted to use a scripting language that called out to unix processes that also did real work on its own, you'd have to step up to perl or python.
(Score: 3, Informative) by turgid on Tuesday January 23 2018, @03:24PM
Someone needs to read the Unix Koans of Master Foo.
I refuse to engage in a battle of wits with an unarmed opponent [wikipedia.org].
(Score: 3, Funny) by Nerdfest on Tuesday January 23 2018, @04:09PM
15 years ago, the internet would like a word with you. Hell even now, but to a lesser degree.
(Score: 2) by fyngyrz on Tuesday January 23 2018, @10:11PM
All I need to know about whatever command shell is running:
And bingo, now I have one set of scripting knowledge that works with Windows, OSX, and linux. And it's hella powerful.
Ideally, I just set a Python script to be executable and run it directly. Or, if a shell command is the only option because... reasons... then what it does is launch a Python script.
It makes no sense to me to use up brainspace with shell esoterica these days.
(Score: 3, Informative) by urza9814 on Tuesday January 23 2018, @10:58PM
I work for a Fortune 10 company. Our core application has a few hundred shell scripts running every night for batch processing, particularly for data coming in from external sources. Various third party companies SFTP a data file, we validate and do some processing of it with a shell script, then we trigger sql or some other process to load into the database if needed. We do the same thing for data output, and that includes output to numerous state and federal regulatory agencies, so it seems to be a pretty typical way of doing these things. In total we've got around half a million lines of bash/ksh running in production...which I'm sure is nothing compared to our application level Java code, but it's still a hell of a lot more than just "configuration scripts or exploratory programming".
(Score: 2) by http on Thursday January 25 2018, @07:23AM
I have worked at a place where customer managment was (i) written in bash, and (ii) run as CGI. Working there taught me almost as much about bash as lhunath's guide. Maybe not the fastest software, but being a small shop, we never had more than three accounts being created or modified at the same time.
Billing, however, was done in perl. Speed matters in some situations.
I browse at -1 when I have mod points. It's unsettling.
(Score: 3, Informative) by canopic jug on Tuesday January 23 2018, @11:40AM (7 children)
Let me guess, all your sessions default to xonsh [xonsh.org] instead of bash or zsh?
Money is not free speech. Elections should not be auctions.
(Score: 0) by Anonymous Coward on Tuesday January 23 2018, @12:46PM (4 children)
I never heard of that. I love the first line of their table, "Sane language" ... bash has no tick
OTOH, I clicked on the xonsh "tutorial" link and got an empty page. Oh dear.
(Score: 2) by tangomargarine on Tuesday January 23 2018, @03:56PM (1 child)
Please tell me "BASHwards-looking" isn't a phrase anybody actually uses. If so, these guys should be slapped for such a crime against the English language.
"Is that really true?" "I just spent the last hour telling you to think for yourself! Didn't you hear anything I said?"
(Score: -1, Redundant) by Anonymous Coward on Tuesday January 23 2018, @08:10PM
https://en.wikipedia.org/wiki/Pun [wikipedia.org]
(Score: 1, Funny) by Anonymous Coward on Tuesday January 23 2018, @05:29PM
See? It's so easy, even an empty tutorial will do. ;-)
(Score: 0) by Anonymous Coward on Wednesday January 24 2018, @08:35AM
☐ Sane web development practices
(Score: 1, Interesting) by Anonymous Coward on Tuesday January 23 2018, @08:35PM (1 child)
fish
(Score: 0) by Anonymous Coward on Wednesday January 24 2018, @09:13AM
https://fishshell.com/ [fishshell.com]
(Score: 3, Insightful) by Snotnose on Tuesday January 23 2018, @04:36PM (4 children)
I've been using Unix since before most of these scripting languages existed. It always takes me by surprise people don't know this stuff.
When I started you had sh, sed, awk, lexx and yacc for scripting. Tcsh, perl, etc etc etc came much later.
/ that's my lawn you're on
// I put a lot of work into maintaining it
/// Hope you're enjoying it, if you have a picnic I want a piece of fried chicken
When the dust settled America realized it was saved by a porn star.
(Score: 3, Interesting) by bzipitidoo on Wednesday January 24 2018, @12:00AM (2 children)
I started on Apple DOS 3.3 and MSDOS. Apple DOS is amazingly primitive-- doesn't even have a native "copy" command, instead has this utility program they called FID to do various file operations, including copy. MSDOS was much more capable, if not as powerful as bash. But it sure can be a lot easier to use. In bash I frequently do "for i in *.ext; do some_command $i ${i%.*}.foo; done" when I used to do "some_command *.ext" in MSDOS, and it worked, because so often the DOS version of the command was a little smarter about generating an appropriate name for the output file.
Heck, it's only recently that I learned of ${i%.*}. Used to use ${i:0:$((${#i}-4))}, which assumes the extension plus dot is 4 characters.
I've tried and tried to grok bison/yacc and flex/lex, but no luck. Bison hates my grammars, always complains of shift/reduce errors. It was easier to bang out a state machine in C by hand than fool endlessly with those utilities.
(Score: 0) by Anonymous Coward on Wednesday January 24 2018, @12:40AM
xargs - learn to use it. xe is nice as well
(Score: 0) by Anonymous Coward on Wednesday January 24 2018, @12:42AM
yeech, I'd pipe it through bloody sed first.
(Score: 0) by Anonymous Coward on Wednesday January 24 2018, @04:24AM
lex/yacc are lexer/parser generators. What the hell are you doing with it in scripting?