Basic Scripting help
8. Create a local variable within your shell by typing the command VAR_ONE=variable1. Create an environment variable by typing the command export VAR_TWO=variable2.
Run the command echo "$VAR_ONE, $VAR_TWO", what output appears? Answer: Obviously when I run this I get variable1,variable2 9. Create a shell script called echo.bash that contains the following lines: VAR_3=three export VAR_4=four echo "$VAR_ONE, $VAR_TWO, $VAR_3, $VAR_4" Give the script execute permissions and execute it by running ./echo.bash. Record the output of the command. (Note, this command requires the variables VAR_ONE and VAR_TWO to exist from the previous question.) Answer: , variable2, three, four (why the comma as the first variable? is that because variable1 was not exported? 10. Run the command echo "$VAR_3, $VAR_4" do the variables VAR_3 and VAR_4 exist in your current shell? Answer: , (Again, why just a comma? because neither was exported to the child process?) Anyone that can explain these a little, woule be awesome! |
Dru*;
At first glance, I thought you had posted a cut and paste homework assignment without comment. I'll highlight what appear to be your comments, but please check to see that I did it correctly. |
Yeah, thats correct. Whats in blue is what I get when running the commands I am told to.
|
Quote:
|
are you talking about when I echo it?
|
Quote:
Quote:
Put echo "$VAR_3, $VAR_4" in another script called child.bash. Now put the following line at the end of echo.bash - ./child.bash This should help to understand the child process getting variables |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 06:52 PM. |