Note that the correct way of creating new variables is without any spaces:
VAR = 42 or
VAR =42 or
Permissions and execution
If you try to create your own bash-script file and run it, Bash will complain about permissions. The reason is, your new text file is not set to be an executable program.or just google "unix permissions".
To quickly fix your issue, do
chmod +x your_bash_script_file. This will add
executable to your file's permissions, and you'll be able to run it.
Program in the working directory
./program just means "run
program that is located in the working directory".
. stands for the working directory, and
/ is just a part of the path, same as in
If your program's location is in
PATH variable already, then you don't need to add
./ even if you're in the same directory with the program, because Bash already knows where to look for your program.
envto view environment variables
VAR=valueto set a new environment variable named
echo $VARto print out the value of
VAR=value ./myscriptto run
myscriptbash script file so that it knows the
export VAR=valueto export a variable to all sessions (it will appear in the
PATHvariable. Bash will look inside
/home/joe/appswhen searching for commands and programss from now on.