Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 17 submissions in the queue.
posted by martyb on Tuesday January 23 2018, @09:52AM   Printer-friendly
from the how-many-did-you-already-know? dept.

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.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Interesting) by bzipitidoo on Wednesday January 24 2018, @12:00AM (2 children)

    by bzipitidoo (4388) on Wednesday January 24 2018, @12:00AM (#626865) Journal

    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.

    Starting Score:    1  point
    Moderation   +1  
       Interesting=1, Total=1
    Extra 'Interesting' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   3  
  • (Score: 0) by Anonymous Coward on Wednesday January 24 2018, @12:40AM

    by Anonymous Coward on Wednesday January 24 2018, @12:40AM (#626880)

    xargs - learn to use it. xe is nice as well

  • (Score: 0) by Anonymous Coward on Wednesday January 24 2018, @12:42AM

    by Anonymous Coward on Wednesday January 24 2018, @12:42AM (#626881)

    ${i:0:$((${#i}-4))}

    yeech, I'd pipe it through bloody sed first.