Changes

Jump to: navigation, search

Tutorial10: Shell Scripting - Part 1

27 bytes added, 09:10, 16 March 2021
INVESTIGATION 2: SHE-BANG LINE / VARIABLES / PARAMETERS
# Run your modified Bash shell script by issuing:<br><span style="color:blue;font-weight:bold;font-family:courier;">./hello.bash</span><br><br>Take time to view the output and the values of the environment variables.<br><br>You can modify the PATH variable to include the current directory (i.e. ".")<br>so you can run the command by just script filename<br>(eg. <span style="font-family:courier;font-weight:bold;">hello.bash</span> as opposed to <span style="font-family:courier;font-weight:bold;">./hello.bash</span>)<br><br>
# Issue the following Linux command to add your current directory to the '''PATH''' environment variable:<br><span style="color:blue;font-weight:bold;font-family:courier;">PATH=$PATH:.</span><br><br>[[Image:hello4.png|thumb|right|330px|Running <u>modified</u> ''hello.bash'' Bash shell script by entering <u>just</u> '''filename''' (i.e. <span style="font-family:courier;">''hello.bash''</span> and NOT <span style="font-family:courier;">''./hello.bash''</span> shown in previous diagram).]]
# Issue the following Linux command to confirm that the current directory '''"."''' <br>has been '''added ''' to the <u>end</u> of the '''PATH''' environment variable:<br><span style="color:blue;font-weight:bold;font-family:courier;">echo $PATH</span><br><br>
# Issue the following to run your Bash shell script just by name:<br><span style="color:blue;font-weight:bold;font-family:courier;">hello.bash</span><br><br>Did your Bash shell script run?<br><br>
# Exit your Matrix session, and log back into your Matrix session.<br><br>
13,420
edits

Navigation menu