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


hpr3551 :: Bash snippet - some possibly helpful hints

Using 'eval', 'mapfile' and environment variables

<< First, < Previous, , Latest >>

Thumbnail of Dave Morriss
Hosted by Dave Morriss on 2022-03-14 is flagged as Explicit and is released under a CC-BY-SA license.
Bash, eval, mapfile, environment variables. 2.
The show is available on the Internet Archive at: https://archive.org/details/hpr3551

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

Duration: 00:24:35

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.

Overview

I write a moderate number of Bash scripts these days. Bash is not a programming language as such, but it’s quite powerful in what it can do by itself, and with other tools it’s capable of many things.

I have enjoyed writing such scripts for many years on a variety of hardware and operating systems, and Bash is my favourite - partly because Linux itself is so flexible.

This is just a short show describing three things I tend to do in Bash scripts to assist with some tasks I find I need to undertake.

  1. Generate Bash variables from a text file - usually output from a program
  2. Fill Bash arrays with data from a file or other source
  3. Use environment variables to control the Bash script’s execution

Long notes

Follow this link to read the detailed notes associated with this episode.


Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2022-03-20 20:26:20 by Some Guy On The Internet

Bash for the Win.

Hello Dave, How are you? I love the show; bash can be very simple or crazy complex depending on your needs. I haven’t used `eval` yet but now I have a reason to use it. Piping text from a file into a script to create commands sounds fun (and scary), so I’ll be experimenting on a Raspberry Pi; so I don’t end the night crying while restoring from a backup, again. Thanks for the show!

Comment #2 posted on 2022-03-21 17:14:44 by Dave Morriss

Hi SGOTI

I appreciate the feedback. Yes, Bash has a lot of power and can be used for many things.

You are right, a Raspberry Pi is a great test bed; I use them often.

I hope you found the show useful. Let us know if you find better ways of doing these types of things.

Best wishes, Dave

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?