13,420
edits
Changes
→INVESTIGATION 2: USING VARIABLES IN SHELL SCRIPTS
# Exit your Matrix session, and log back into your Matrix session.<br><br>
# Re-run the hello.bash shell script by just using the name.<br><br>What did you notice?<br><br>The setting of the PATH variable only worked in the current session only. If exit the current Matrix session, then the recently changed settings for environment variables are lost. You will learned in Week 12 how to set environment variables in startup files.<br><br>
# Use a text editor to create a file called '''user-variables.bash'''<br><br>
# Add the following lines to the bottom of the file:<br><span style="font-family:courier;">age=25<br>read -p "Enter your Full Name" name<br>read -p "Enter your age (in years): " age<br>echo "Hello $name - You are $age years old"</span><br><br>
# x
In the next investigation, you will ...