Kafla:9 og 12.
bókin á netinu:
http://www.qfpost.com/file/d?g=rYT31r7zd
Nokkuð viss um að hún sé ekki höfundarvarin lengur..
Ef eitthver einn tekur að sér að gera allt þá skal ég millifæra á hann 2kall
Spurningar:
kafli:9
Prime Bbcode Spoiler Show Prime Bbcode Spoiler: K9_Partur 1
1. Modify your eatout.sh script to accept no parameters. In this event, it should
being in an interactive mode, allowing the user to enter their restaurant and
rating.
2. Ensure you do adequate error checking in this script such that if the user enters
incorrect ratings or types, you inform them as such and request a new rating,
type.
being in an interactive mode, allowing the user to enter their restaurant and
rating.
2. Ensure you do adequate error checking in this script such that if the user enters
incorrect ratings or types, you inform them as such and request a new rating,
type.
Prime Bbcode Spoiler Show Prime Bbcode Spoiler: K9_Partur 2
Exercises:
1. Modify your eatout.sh script to format output in a standard way. Ensure that the
output is justified as described above.
2. Write a script that will use the output of the df command and reformat it in a
way that makes it easy to read. Output should be as follows:
<Mount Point>\t<% Free Space>\t<% Used Space>\t<Total Space>
a. Ensure that headings appear at the top of your output as illustrated here.
b. The \t indicate TABs between each of these headings.Ensure that the
output of this script, each time it is run, is appended to a log file
/tmp/df.output.log
3. Write a script similar to 2 above this time formatting the output of the memory
in a similar manner.
4. Combine the scripts in 2 and 3 to produce a single script that will do the
memory and the disk space on the system at once.
1. Modify your eatout.sh script to format output in a standard way. Ensure that the
output is justified as described above.
2. Write a script that will use the output of the df command and reformat it in a
way that makes it easy to read. Output should be as follows:
<Mount Point>\t<% Free Space>\t<% Used Space>\t<Total Space>
a. Ensure that headings appear at the top of your output as illustrated here.
b. The \t indicate TABs between each of these headings.Ensure that the
output of this script, each time it is run, is appended to a log file
/tmp/df.output.log
3. Write a script similar to 2 above this time formatting the output of the memory
in a similar manner.
4. Combine the scripts in 2 and 3 to produce a single script that will do the
memory and the disk space on the system at once.
Kafli 12:-Búinn með þetta
Prime Bbcode Spoiler Show Prime Bbcode Spoiler: K12_Partur 1- Búinn með þetta.
Exercises:
1. Ensure that the user is unable to break the eatout.sh script from running with the
break command.
2. When your script exits, send a message to all users logged onto the system.
Hint: see the man page for wall(1).
3. Set a trap in your eatout.sh script that will allow you, the wizz shell
programmer to step through your script one command at a time.
4. Ensure that, on login to a new terminal, the SIGSTOP signal is trapped and a
message printed accordingly. How would you test this?
1. Ensure that the user is unable to break the eatout.sh script from running with the
break command.
2. When your script exits, send a message to all users logged onto the system.
Hint: see the man page for wall(1).
3. Set a trap in your eatout.sh script that will allow you, the wizz shell
programmer to step through your script one command at a time.
4. Ensure that, on login to a new terminal, the SIGSTOP signal is trapped and a
message printed accordingly. How would you test this?
Prime Bbcode Spoiler Show Prime Bbcode Spoiler: K12_Partur 2
Exercises
1. Modify your eatout script in such a manner that any errors produced by the
script will be redirected to a file called eatout.err in your home directory.
2. Allow the user to select from the menu in eatout.sh, but ensure that their
keystrokes are recorded in a file called eatout.log
Exercises 241
3. Write a script that should take two arguments, an input file (-i infile) and an
output file (-o outfile). Using file descriptor redirection, the script should
convert all data from the input file (infile) to uppercase and write the
uppercased file to the output file (outfile). Ensure that your script does all
necessary error checking, that it cannot be 'broken out of', killed, etc. and that
all user options are adequately checked to ensure they conform to that required.
Ensure that exit status' are supplied if errors are detected. An example of the
command line is given below:
upcase.sh -i bazaar.txt -o BAZAAR.TXT
1. Modify your eatout script in such a manner that any errors produced by the
script will be redirected to a file called eatout.err in your home directory.
2. Allow the user to select from the menu in eatout.sh, but ensure that their
keystrokes are recorded in a file called eatout.log
Exercises 241
3. Write a script that should take two arguments, an input file (-i infile) and an
output file (-o outfile). Using file descriptor redirection, the script should
convert all data from the input file (infile) to uppercase and write the
uppercased file to the output file (outfile). Ensure that your script does all
necessary error checking, that it cannot be 'broken out of', killed, etc. and that
all user options are adequately checked to ensure they conform to that required.
Ensure that exit status' are supplied if errors are detected. An example of the
command line is given below:
upcase.sh -i bazaar.txt -o BAZAAR.TXT
Prime Bbcode Spoiler Show Prime Bbcode Spoiler: K12_Partur 3
Exercises
1. Write a script that will itself create a script, which will automatically logout
users who have been idle for longer than 15 minutes. Hint: Consult the example
above.
2. Using HERE documents, write a script that will generate a table 3x2 in size.
Ensure that each block contains a picture or animated gif. There are a couple of
gifs provided with this course. Alternatively, you can download your own. I
found those from
3. Modify your eatout.sh script to include a usage section. Give
1. Write a script that will itself create a script, which will automatically logout
users who have been idle for longer than 15 minutes. Hint: Consult the example
above.
2. Using HERE documents, write a script that will generate a table 3x2 in size.
Ensure that each block contains a picture or animated gif. There are a couple of
gifs provided with this course. Alternatively, you can download your own. I
found those from
3. Modify your eatout.sh script to include a usage section. Give
Prime Bbcode Spoiler Show Prime Bbcode Spoiler: k12_Partur 4
Exercises:
With your newfound knowledge of functions, write the following scripts.
1. Modify your script from earlier, which showed the disk space and memory in
HTML format. Only this time, ensure that each of these tasks are separated into
individual functions.
2. Write a function that may be used on the command line, which will show your
hardware address, IP address and default gateway on your machine.
3. I often need to change between a DHCP and a static address, and this provides
a source of stress for me as each time I need to modify the files, restart the
network, etc. Write a function that I can run on the command line that will
prompt me for all the manner of my network configuration. It should ask
whether we require DHCP / static addressing and if static is selected, it should
require us to enter the IP address, the netmask, the default gateway and the
DNS server(s). Ensure that the function will restart the necessary services once
we have chosen our method of network settings.
With your newfound knowledge of functions, write the following scripts.
1. Modify your script from earlier, which showed the disk space and memory in
HTML format. Only this time, ensure that each of these tasks are separated into
individual functions.
2. Write a function that may be used on the command line, which will show your
hardware address, IP address and default gateway on your machine.
3. I often need to change between a DHCP and a static address, and this provides
a source of stress for me as each time I need to modify the files, restart the
network, etc. Write a function that I can run on the command line that will
prompt me for all the manner of my network configuration. It should ask
whether we require DHCP / static addressing and if static is selected, it should
require us to enter the IP address, the netmask, the default gateway and the
DNS server(s). Ensure that the function will restart the necessary services once
we have chosen our method of network settings.