Hjálp með skólaverkefni? #!/bin/bash


Höfundur
dawg
Ofur-Nörd
Póstar: 282
Skráði sig: Fös 12. Nóv 2010 16:54
Reputation: 1
Staða: Ótengdur

Hjálp með skólaverkefni? #!/bin/bash

Pósturaf dawg » Fim 08. Maí 2014 20:13

Sælir, getiði hjálpað mér með þessar spurningar?
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.

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.


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?


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


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

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.



Skjámynd

Frantic
FanBoy
Póstar: 797
Skráði sig: Mið 04. Mar 2009 17:43
Reputation: 6
Staða: Ótengdur

Re: Hjálp með skólaverkefni? #!/bin/bash

Pósturaf Frantic » Fim 08. Maí 2014 22:53

Ég myndi ekki einu sinni nenna að opna editor fyrir 2000 kall. :D
Af hverju gerirðu þetta ekki sjálfur? Hvað er að flækjast fyrir þér?
Lærir meira á því að google-a og reyna sjálfur.




Höfundur
dawg
Ofur-Nörd
Póstar: 282
Skráði sig: Fös 12. Nóv 2010 16:54
Reputation: 1
Staða: Ótengdur

Re: Hjálp með skólaverkefni? #!/bin/bash

Pósturaf dawg » Fim 08. Maí 2014 23:16


Frantic skrifaði:Ég myndi ekki einu sinni nenna að opna editor fyrir 2000 kall. :D
Af hverju gerirðu þetta ekki sjálfur? Hvað er að flækjast fyrir þér?
Lærir meira á því að google-a og reyna sjálfur.

haha andsk, klára þessi 2 verkefni og þá er ég kominn með það sem ég þarf til að geta útskrifast, hef eiginlega ekki nægan áhuga á þessu einsog er. :)

Aðal málið hisnvegar er að ég týndi skriptunum sem ég á að nota og hef ekki enþá fundið þær í bókinni aftur. Veit þær eru þarna eitthverstaðar.

Fyrir utan það þá er þetta bara svo mikið vesen og basl og til þess að bæta ofaná vesenið þá var virtual diskurinn sem hýsir distroið að corruptast þannig ég þarf að setja það upp á nýtt.

Þetta er samt að mestu bara væl í mér, þarf eiginlega bara að drífa þetta af.
Annars var ég ekki að finna error checkið í bókinni, í kafla 9.