Jul 05, 2008 21:40
I'm trin to help a friend with their Unix HW. I will be the 1st to admit I have no fucking clue about the differnace between unix and linix and the like... Looking at this stuff makes me go...wth.. I mean I used... Qbasic back in like...5th grade and I sure as fuck dont remeber any of that. :P
/sigh I guess I should learn this stuff too.
1. (3 points) Develop a bash shell script called "unix" that writes out "UNIX is cool!" 10 (ten) times using a loop.
Be sure to include the shell commands for your shell script below.
2. (4 points) Develop a bash shell script called "classcount" that writes out "Total accounts in csi135a: " and then determines and writes out from the /etc/passwd file the total number of accounts for our class on Vader.
Be sure to include the shell commands for your shell script below.
3. (8 points) Develop a bash shell script called "sentence" that accepts a sentence (without a period) of up to 9 (nine) words in length.
Your script should write out on the 1st output line "This is script: " followed by the script's name as determined from a positional parameter.
It should then write out on the 2nd line "Error: No sentence input" if nothing is entered.
If something was entered, it should write out on the 2nd line the entire sentence
On the 3rd line it should write out "No. words in sentence = " followed by the number of words.
On the 4th line it should output "No. letters in sentence = " followed by the number of letters, including spaces and the newline character at the end of the sentence.
On the 5th line it should write out "No. words containing e = " followed by the number of words in the sentence that contain the letter "e".
Be sure to include the shell commands for your shell script below.
THAT is my assignment for the first question I have
#!/bin/bash
for var in list
count=0
repeat 10 echo UNIX is cool!
until [ $count -eq 10 ]
do
echo UNIX is cool!
count='expr $count +1'
done
but i keep getting an error with teh count var.. maybe if I put it above the for var in list part?