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

hpr2448 :: Useful Bash functions - part 3

A few more possibly useful Bash functions are discussed

<< First, < Previous, , Latest >>

Thumbnail of Dave Morriss
Hosted by Dave Morriss on 2017-12-20 is flagged as Explicit and is released under a CC-BY-SA license.
coding, Bash, script, function. 6.
The show is available on the Internet Archive at:

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

Duration: 00:33:53

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.

Useful Bash functions - part 3


This is the third show about Bash functions. These are a little more advanced than in the earlier shows, and I thought I'd share them in case they are useful to anyone.

As before it would be interesting to receive feedback on these functions and would be great if other Bash users contributed ideas of their own.

Full Notes

Since the notes explaining this subject are long, they have been placed here.


Subscribe to the comments RSS feed.

Comment #1 posted on 2017-12-20 14:34:37 by STLShawn


I have worked with DOS and windows for twenty five years now. My only nix experience was with phone systems and hotel systems with which I administered through step by step procedures. I am now starting to learn a bit more command line Linux as I have started playing with raspberry pi computers and switched a couple of laptops to Xubuntu and Mint XFCE. As you probably guessed, a lot of the show went over my head, but it is fascinating to hear the possibilities for automation that are available if I could learn more of Bash commands. This series has been very helpful to me in developing a desire to learn more and find things that I could try to automate. Thank you very much for your hard work. Shawn

Comment #2 posted on 2017-12-20 17:12:26 by Dave Morriss

Thanks Shawn

I'm glad you found it interesting, and hope this series proves to be useful to you. I plan to do more shows on Bash functions and Bash features in general in the future.


Comment #3 posted on 2017-12-21 12:55:18 by Mike Ray

Bash shows

Keep it coming Dave.

I do a lot of bash programming, mostly because I work on the assumption that if I need to type the same complex command-line more than twice it should be a script, to cut down on typing, trying to remember stuff, and to cut down on errors.

I don't enjoy bash programming very much. Mostly because I hate not being able to use normal language constructs like:

result = function(argumments)

So the more tips and ideas from anybody else who faces the same questions the better

Comment #4 posted on 2017-12-21 19:04:13 by Dave Morriss

Thanks Mike

Glad these are turning out to be useful.

I have always been fascinated by what I guess can be called 'command languages'. I have worked with the GEORGE operating system that had a fairly basic one, and VMS, which which had DCL (Digital Command Language), which grew to be fairly sophisticated during my time using it. However, in comparison, I find Bash to be considerably more sophisticated. Still not a true language with features like those you describe, but nevertheless worth working with I think.

It's this that motivates me to describe what can be done with Bash, and I amuse myself trying to do things that stretch my imagination a bit :-)


Comment #5 posted on 2017-12-29 16:03:41 by Mike Ray


How about some shows about the various built-in variables? I have made use of BASH_REMATCH (dollar sign excluded because I assume it might break something), but I assume there are more I have missed.

Comment #6 posted on 2017-12-29 16:39:39 by Dave Morriss


Great suggestion.

On my list of future Bash topics I have Regular Expressions, quite near the top. That episode would include BASH_REMATCH of course.

I have mentioned one or two of the other Bash variables in passing such as FUNCNAME , but there are many more.

Thanks for the feedback.

By the way, with our new comment system we strip HTML but take measures to try to ensure all other ASCII characters pass through unhindered. So dollar signs ($) shouldn't be a problem.

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:
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?