Changes

Jump to: navigation, search

Tutorial10: Shell Scripting - Part 1

200 bytes added, 09:51, 11 March 2021
INVESTIGATION 2: SHE-BANG LINE / VARIABLES / PARAMETERS
# Use a text editor to edit the shell script called '''hello.bash'''<br><br>
# Add the following lines to the <u>bottom</u> of the file:<br><span style="font-family:courier;font-weight:bold;">echo<br>echo "The current directory location is: $PWD"<br>echo "The current user home directory is: $HOME"<br>echo</span><br><br>
# Save your editing changes and exit your text editor.<br><br>[[Image:hello4-0.png|thumb|right|330px|Running <u>modified</u> '''hello.bash''' Bash shell script by using relative pathname: '''./hello.bash''']]
# Run your renamed shell script for confirmation 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>
# 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 by <u>just</u> '''filename''' only(i.e. ''./hello.bash'' shown in previous diagram).]]
# Issue the following Linux command to confirm that the current directory '''"."''' has been added to 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>
13,420
edits

Navigation menu