Modify the foreach_1 script (page 404) so that it takes the command to exec as an argument.
What will be an ideal response?
$ cat foreach_2
#!/bin/tcsh
# routine to zero-fill argv to 20 arguments
#
set buffer = (0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
set count = 1
#
if ($#argv > 21) goto toomany
#
set cmd = $1
# check that first arg is valid command
which $1 > /dev/null
if ($? > 0) goto usage
shift
#
foreach argument ($argv[*])
set buffer[$count] = $argument
@ count++
end
#
exec $cmd $buffer[*]
#
toomany:
echo "Too many arguments given."
echo "Usage: foreach_2 command [up to 20 arguments]"
exit 1
#
usage:
echo "First argument must be a command."
echo "Usage: foreach_2 command [up to 20 arguments]"
exit 1
You might also like to view...
Critical Thinking QuestionsCase 7-2Lynda, the administrative assistant to the sales director, has just received a new slide show from the marketing department. Her boss is taking the slide show to an industry conference and plans to have it run unattended in the company's kiosk in the exhibit hall. Lynda sends you an e-mail asking for help preparing for a self-running presentation.
Lynda also wants to know how to set up the slide show to run unattended in a continuous loop throughout the day. You tell Lynda to ____. a. click the Set Up Slide Show button (SLIDE SHOW tab | Set Up group) to open the Set Up Show dialog box; click the ‘Browsed at kiosk (full screen)' option and click OKc. click the Set Up Slide Show button (SLIDE SHOW tab | Run Show group) to open the Slide Show dialog box; click the ‘Browsed at kiosk (full screen)' option and click OKb. click the Run in Kiosk button (SLIDE SHOW tab | Set Up group) to open the Set Up Show dialog box; click the ‘Browsed at kiosk (full screen)' option and click OKd. click the Run Show button (SLIDE SHOW tab | Options group) to open the Run Show dialog box; click the ‘Browsed at kiosk (full screen)' option and click OK What will be an ideal response?
You are the network manager for a computer training center that allows students to bring their own laptops to class for learning and taking notes. Students need access to the Internet, so you have configured your network's DHCP server to issue IP addresses automatically. Which DHCP option should you modify to make sure you are not wasting addresses used by students who have left for the day?
What will be an ideal response?
Type can be modified using all the transform commands on the Edit menu except Perspective and ____________________.
Fill in the blank(s) with the appropriate word(s).
Answer the following statement(s) true (T) or false (F)
1. Dint type tags can be used to hold integers. 2. : BOOL type tags can be used to hold binary numbers up to 16 digits long. 3. REAL type tags are only used to hold actual I/O data from the real-world process. 4. Only one task is active at a time. 5. The lowest priority task is the continuous task.