Infrasonic wrote:https://www.howtogeek.com/442332/how-to ... lfp3-TP61U
How to Work with Variables in Bash
Variables are vital if you want to write scripts and understand what that code you’re about to cut and paste from the web will do to your Linux computer. We’ll get you started!
Cont.
Not sure how far ahead you are on this, my friend, but do beware that if you assign some variables in a text file e.g.
PRINTER="192.168.0.55"
MAX_JOBS=5
..
then executing this file from your current shell, will not result in those variables being assigned into the shell. This is because current shell creates a subshell to run the script, and unless you state otherwise the lifetime of those variables will be bound to the lifetime of the subshell.
In order to assign the variables into your current shell use the "export" directive e.g.
export PRINTER="192.168.0.55"
export MAX_JOBS=5
..
and in order for bash to parse your variables file text use either the "dot space" syntax or "source" command, e.g.
$ . file.txt
or
$ source file.txt
Hope this helps. Apologies if this "old hat" for you!
Matt