https://stackoverflow.com/questions/27472540/difference-between-and-in-bash
$()
means: "first evaluate this, and then evaluate the rest of the line".
Ex :
echo $(pwd)/myFile.txt
will be interpreted as
echo /my/path/myFile.txt
On the other hand ${}
expands a variable.
Ex:
MY_VAR=toto
echo ${MY_VAR}/myFile.txt
will be interpreted as
echo toto/myFile.txt
$ is same as ${}
// https://www.linuxtechi.com/variables-in-shell-scripting/
print list of all ENV
printenv command
print ENV variable :
echo $HOME
//
export is to export vairable for sub process(if used on terminal, put in bash_profile for current user session)
https://stackoverflow.com/questions/7411455/what-does-export-do-in-shell-programming
$ foo=bar
$ bash -c 'echo $foo'
$ export foo
$ bash -c 'echo $foo'
bar
No comments:
Post a Comment