Changes

Jump to: navigation, search

Tutorial10: Shell Scripting - Part 1

72 bytes added, 11:03, 5 March 2021
INVESTIGATION 2: USING VARIABLES IN SHELL SCRIPTS
# Save your editing changes and exit your text editor.<br><br>Notice how the quoting character "'''\'''" is used to display positional parameters like "'''$2'''"<br>as opposed to the value stored in the <u>second</u> positional parameter.<br><br>
# Issue the '''chmod''' command to add '''execute permissions''' for the user for the '''parameters.bash''' file.<br><br>
# Issue the following to run the '''user-variables.bash''' Bash shell script:<br><span style="color:blue;font-weight:bold;font-family:courier;">./parameters.bash</span><br><br>What happened?<br><br>The values for some of the ''positional parameters '' and ''special parameters'' may not NOT be <br>displayed properly since you did NOT provide any '''arguments ''' when <u>running the </u> your Bash shell script.<br><br>
# Issue the following to run the user-variables.bash Bash shell script with arguments:<br><span style="color:blue;font-weight:bold;font-family:courier;">./parameters.bash 1 2 3 4 5 6 7 8</span><br><br>Take some time to view the results and how the parameters are changed when using the shift command. What do you notice?<br>
13,420
edits

Navigation menu