I'm currently preparing for an exam and came across two question I'm having trouble with. I don't have access to my pc right now, so I can't test this stuff out myself and with no success in other forums, I hope to find some help here.
1. The following Shell Script
myscript.sh k=0 while read WORT do echo $WORT|grep s>/dev/null || echo $WORT|grep r>/dev/null || let k=$k+1 done echo $k
The script is then initated with the line:
ls | /home/notroot/scripts/myscript.sh
In the current directory are the following files: Asprin, Benz, Burroughs, Claremont, Eddings, Doms, Gardner, Lucas, Martin, McKiernam,
And how often are the following statements invoked:
2. "echo $WORT|grep s>/dev/null"
3. "echo $WORT|grep r>/dev/null"
4. "let k=$k+1"
5. "echo $k"
If I understand the script correctly, k would be increased every time the script comes across a file that contains at least one S and at least one R. So the files Asprin, Burroughs and Schlederer would lead to an increment of the variable k.
As for how often the statements are invoked:
1. 15 times
2. 7 times
3. 3 times
4. 3 times
Did I unserstand the script correctly?
2. Setting up an HDD for a linux based video server
You want to set up a hard drive for a videoserver under linux.
- The videofiles will have a size of at least 10MB and a maximum of 8GB.
- The hard drive has a disk space of 1TB.
- You can choose one of the following block sizes: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024kB.
Which block size do you choose for the filesystem and what's the maximum number of I-Nodes you would need.
Additionally you also want to set up another filesystem for administrative data under the same conditions as above. The files have an average size of 150 Byte and the Filesystem is supposed to have a size of 100MB. Which block size do you choose?
I have no idea how answer this exactly, but I suppose the maximum amount of i-nodes for a 1TB hard drive is around 31M since there's 1 i-node created for every 32KB of space. But as for the block sizes, I have no idea what to choose. I imagine 1MB would work to not fragment the files too much.
Any help is much apprecaited.
Thanks in advance and cheers!