Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Do the following Create the local variable foo and assign it the value \"FOO\" C

ID: 3702038 • Letter: D

Question

Do the following

Create the local variable foo and assign it the value "FOO"

Create the global variable bar and assign it the value "BAR"

Write a single command that will print the values of foo and bar

Do the following

Copy print_foo_bar.sh from /home/ghoffman/course_files/it244_files to your hw8 directory

Run print_foo_bar.sh

The value of foo will not print because it is local to the login shell and cannot be seen in a subshell.Do the following

Create the global variable my_city and assign it the name of the town you live in

Write an echo statement that uses my_city to tell me where you live.
The everything after echo must be quoted.

Print the value of the keyword shell variable whose value is a list of all the directories Bash will search to find an executable file with the same name as the command you typed on the command line.

Print the value of the keyword shell variable whose value is the absolute pathname of your default shell.

Run a command that will show you all your global variables.

Explanation / Answer

Hi I have answered first two Questions.

Please repost others in separate post.

Please let me know in case of any issue in my answer.

=============================================================

Create the local variable foo and assign it the value "FOO"

[Answer] echo "FOO" > foo

Create the global variable bar and assign it the value "BAR"

[Answer] echo "BAR" > ~/bar

Write a single command that will print the values of foo and bar

[Answer] Create a file print_foo_bar.sh using vim.

vim print_foo_bar.sh

add below entries in this file

cat foo

cat ~/bar

Now, run this file --> . print_foo_bar.sh

==============================================================

Copy print_foo_bar.sh from /home/ghoffman/course_files/it244_files to your hw8 directory

[Answer] use cp command

Run print_foo_bar.sh

[Answer] . print_foo_bar.sh

The value of foo will not print because it is local to the login shell and cannot be seen in a subshell.

========================================================

Please DONT forgot to rate my answer. We are working hard for you guys!!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote