Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at


hpr1884 :: Some more Bash tips

Some information about brace expansion in Bash that you might not know

<< First, < Previous, , Latest >>

Thumbnail of Dave Morriss
Hosted by Dave Morriss on 2015-10-22 is flagged as Explicit and is released under a CC-BY-SA license.
Bash, brace expansion, seq. 4.
The show is available on the Internet Archive at: https://archive.org/details/hpr1884

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:15:49

Bash Scripting.

This is an open series in which Hacker Public Radio Listeners can share their Bash scripting knowledge and experience with the community. General programming topics and Bash commands are explored along with some tutorials for the complete novice.

Some more Bash tips

We looked at Parameter Expansion back in HPR episode 1648 where we saw how Bash variables could be used, checked and edited. There are other sorts of expansions within Bash, and we'll look at one called "Brace Expansion" in this episode, which follows on from episode 1843 "Some Bash tips".

I have written out a moderately long set of notes about this subject and these are available here https://hackerpublicradio.org/eps/hpr1884_full_shownotes.html.


Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2015-10-27 19:07:10 by Frank

Thank you, Dave. A very nice piece of work.

I've been trying to understand regular expressions (I guess because I like puzzles). In addition to giving me a better understanding of bash, the examples you gave show similarity with some regular expression syntax, which in turn gives some context to regular expression syntax, so that it does not seem to be quite so foreign a language.

Comment #2 posted on 2015-10-27 19:49:37 by Dave Morriss

Thanks Frank, glad you enjoyed it

The regular expression subject is a complex one. I've been wondering whether I should try and pass on what I know about it.

Strictly this brace expansion topic is in the area of using patterns to match filenames. Confusingly this is similar but not the same as regular expressions. In later episodes in this (not-)series I want to talk more about filename matching then look at regular expressions in the context of Bash.

Really, the regular expression subject could (should?) be stand-alone and should look at what's available in Bash, grep, sed, awk, etc. I use Perl regular expresions the most but I hesitate to go too deep there because they are mind-blowing :-)

Comment #3 posted on 2015-10-28 22:01:14 by Frank

Indeed regular expressions are complex. They make my brain hurt.

Seeing some kinship with shell commands--some indication that whoever perpetrated regex did not just make it up from the whole cloth--is somehow comforting.

I recently stumbled over a great *beginner's* tutorial. https://www.digitalocean.com/community/tutorials/using-grep-regular-expressions-to-search-for-text-patterns-in-linux#basic-usage

What makes it so good is that it uses the GPL text found on every Linux computer for the exercises, so you can practice the examples and try different options as you read along.

Comment #4 posted on 2015-10-29 11:44:38 by Dave Morriss

Regular expressions

I skimmed through that tutorial, and it looks very good. Thanks for the pointer.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
What is the HOST_ID for the host of this show?
What does HPR mean to you?