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.
Since the notes explaining this subject are long, they have been placed here.
Previous HPR episodes in this group Useful Bash functions:
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.
Comment #2 posted on 2017-12-20 17:12:26 by Dave Morriss
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
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
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
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.
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 :).