subject

The shell expands $0 to the name of the calling program (sobell, page 461), $1–$n to the individual command-line arguments (positional parameters; sobell, page 462), $* (sobell, page 465) to all positional parameters, and $# (sobell, page 466) to the number of positional parameters.1. write a script named all that displays (sends to standard output) the name of the calling program, the number of positional parameters, and a list of positional parameters. include the #! line (sobell, page 287) and a comment (sobell, page 288). remember to make the file executable (sobell, page 100). test the script with 0, 1, and 5 positional parameters.2. make a symbolic link (sobell, page 113) named linkto to the all script you wrote in the previous step. call linkto with two arguments. what does the script report as the name it was called as? 3. write a script named myname that uses echo (most of the examples in chap- ter 10 use this utility) to prompt the user with enter your name: , reads into a variable the string the user types in response to the prompt, and then dis- plays hello followed by the string the user typed. when you run the program it should look like this: $ ./myname enter your name: max wild hello max wild4. rewrite myname from the previous step, calling it myname2. have this version of the program prompt the user for a string, but instead of displaying hello and the string on the screen (sending it to standard output) redirect the output so the program writes only the string the user entered (and not hello) to the temporary file named pid. name where pid is the process id number (sobell, page 467) of the process running the script. display the contents of the pid. name file.5. write and run a script named looper that uses the for (sobell, page 434) control structure to loop through the command-line arguments and display each argument on a separate line.6. rewrite looper from the previous step, calling it looper2. have this version of the program use the control structure (sobell, page 432) to perform the same task.7. write a script named ifthen that prompts the user with > > and reads a string of text from the user. if the user enters a nonnull string, the script displays you entered: followed by the string; otherwise it displays where is your input? . use an control structure (sobell, page 424) to imple- ment the two-way branch in the script. use the test (sobell, pages 420 and 978) builtin to determine if the user enters a null string. what do you have to do to avoid getting an error message when you prompt with > > ? (there are several ways to construct the test statement.)8. write and run a simple shell script named echomyvar that displays the pid (sobell, page 467) of the process running the script and value of the variable named myvar. display the pid of the interactive shell you are working with. what is the value of the variable within the process running the shell script? are the interactive shell and the shell running the script run by the same or different processes (do they have the same pid)?

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
You should hand write your references on your resume.
Answers: 1
question
Computers and Technology, 21.06.2019 21:30
Asuccessful format string attack attempted to steal user account information by reading from unauthorized memory. answer the followings with proper explanation a)this attack will lead to violation of which security policies?
Answers: 2
question
Computers and Technology, 22.06.2019 09:30
What are the steps involved in accepting all the changes in a document? arrange these in order click edit. click accept or reject. click changes. click accept all.
Answers: 1
question
Computers and Technology, 23.06.2019 17:20
What is the best assassins creed game?
Answers: 2
You know the right answer?
The shell expands $0 to the name of the calling program (sobell, page 461), $1–$n to the individual...
Questions
question
Mathematics, 10.04.2020 22:15
question
Mathematics, 10.04.2020 22:15
question
Mathematics, 10.04.2020 22:15
question
Chemistry, 10.04.2020 22:15
Questions on the website: 13722362