• Make sure you are in your home directory (and not your labs directory) • Use an editor to create a file called firstsc

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

• Make sure you are in your home directory (and not your labs directory) • Use an editor to create a file called firstsc

Post by answerhappygod »

Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 1
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 1 (169.84 KiB) Viewed 28 times
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 2
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 2 (134.48 KiB) Viewed 28 times
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 3
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 3 (135.19 KiB) Viewed 28 times
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 4
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 4 (151.31 KiB) Viewed 28 times
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 5
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 5 (124.45 KiB) Viewed 28 times
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 6
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 6 (136.26 KiB) Viewed 28 times
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 7
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 7 (121.87 KiB) Viewed 28 times
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 8
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 8 (132.29 KiB) Viewed 28 times
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 9
Make Sure You Are In Your Home Directory And Not Your Labs Directory Use An Editor To Create A File Called Firstsc 9 (127.8 KiB) Viewed 28 times
• Make sure you are in your home directory (and not your labs directory) • Use an editor to create a file called firstscript. The contents of the file should be: #!/bin/bash echo "This is an interactive script." echo-n "What is your name? ,, read "name" echo "Hi $name!" • The preceding file is a "script" file of shell commands that we can run (like a .BAT file in DOS). • Enter firstscript Hmmm, it didn't run. • Maybe the file needs to be executable. Make firstscript executable for yourself (the owner) only. MAKKARI (1) What command did you use?
(1) What command did you use? Answer: • Enter ls -1 firstscript to verify this. (2) What are the permission bits? Answer: • Enter firstscript It STILL did not run! . Maybe the script is not found in your search path. Enter echo $PATH to see what your path is. (3) Why wasn't the script found? Answer: • Enter ./firstscript (4) Why did this work? Answer: • Create a directory under your home directory called bin
(4) Why did this work? Answer: ● Create a directory under your home directory called bin (5) What command did you use? Answer: • Move the firstscript file to your bin directory. (6) What command did you use? Answer: • Enter firstscript (7) Explain why this now works. There are 2 reasons ... both of which you have now resolved. Answer: • Move the firstscript file from your bin directory back to your
(7) Explain why this now works. There are 2 reasons... both of which you have now resolved. Answer: • Move the firstscript file from your bin directory back to your home directory. (8) What command did you use? Answer: • Make sure you are in your home directory. • Remove the execute permission from the script file. (9) What command did you use? Answer: • Enter firstscript to try to run the script again. It should fail. • Enter bash ./firstscript It should
(9) What command did you use? Answer: • Enter firstscript to try to run the script again. It should fail. • Enter bash ./firstscript It should have worked. • Enter bash firstscript That also should have worked. (10) What conclusions can you make about running a script as an argument to a shell? Answer: • Enter tcsh (11) What did this command do? Answer: • Now enter bash
(12) What did this do? Answer: • Enter ps -1 You should see 4 lines. • Take a look at the PID and PPID (Parent PID) fields and you should be able to see that bash started tesh which in turn started bash which started ps Enter exit twice. (13) What shell are you now running? Answer: (14) How can you tell which shell you are running? Answer: • Use Is to make sure you don't have a file named xxx (If it's there, remove it!) • Enter ls xXX
Answer: • Enter Is xfactor xxx . This should have written one line of standard output and one line of standard error. • Enter Is xfactor xxx > file1 (18) What does > do? Answer: • Enter Is xfactor xxx &> file2 (19) What does &> do? Answer: .Write 1 command line to run 2commands. Echo the words "Here are the files:" and then run an Is command. (20) What was the command line? Answer:
(14) How can you tell which shell you are running? Answer: • Use Is to make sure you don't have a file named xxx (If it's there, remove it!) • Enter ls XXX (15) Is the output from the last command standard output or standard error? Answer: • Enter Is xxx 2>myerror (16) What does the notation 2> mean? Answer: • Enter cat myerror if you want to see the contents of that file. • Create a new empty file called xfactor
(17) What command did you use? Answer: • Enter Is xfactor xxx . This should have written one line of standard output and one line of standard error. • Enter Is xfactor xxx > file1 (18) What does > do? Answer: • Enter Is xfactor xxx &> file2 (19) What does &> do? Answer: • Write 1 command line to run 2commands. Echo the words "Here are the files:" and then run an Is command. (20) What was the command line?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply