Unix questions Q4. Commands to study to answer this question: Read about test, s
ID: 3732666 • Letter: U
Question
Unix questions
Q4. Commands to study to answer this question: Read about test, shift, while loop, expr,
displaying the value of the two-character variable $1 using echo command
1) Exit from script, if is currently enabled; if it is not enabled, skip this item (1)
2) Using the vi editor, create a shell script file that displays the first 12 command line arguments. You must use a whileloop, expr and shift shell commands in the script to do this question.
3) Issue script command to capture the output of the items below
4) Add execute permission to the file
5) Display the attributes of the script file
6) Display the content of the script file
7) Run the script file by typing the name of the script file and specifying 14 or more arguments
Explanation / Answer
1). exit N
shift $1
fi
2). i=1
while [$i -le 12] ;do
echo $i
shift
done
3) sh scriptfile.sh > filename.txt
you can store the output in any file.
4) chmod +x filename.sh
chmod is a command that will change the mod of the file +x is execute command added.
5) stat filename.txt
stat command is used to display the file attribute
6) cat filename
7) ./filename.sh arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 arg11 arg12 arg13 arg14
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.