Question
Revision Question 3 on Linux. Please explain the shell script commands in the context of post execution. You have just logged in and have a
Revision Question 3 on Linux. Please explain the shell script commands in the context of post execution.
You have just logged in and have a directory called "novel" in your home directory containing the following files:
chapter1.docx chapter2.docx chapter3.docx draft.pdf save
where "save" is itself a directory and contains the files
Attributes.txt draft.pdf.1 draft.pdf.2 draft.pdf.3 indexA.txt indexB.txt list1.txt list2.txt
a) Describe the results you would expect when executing the following shell commands:
i) ls novel/save/*A*
ii) ls novel/*r[23]*
iii) rmdir novel
iv) ls novel | wc -l
v) rm -r novel/save
(assume each command is run when the directory "novel" is as described above)
b) Consider the following short shell script
#!/bin/sh
cd $1
cnt = ` ls save/$2* | wc -l`
for i in $2*
do
cnt=$((cnt+1))
cp $i save/$i$cnt
done
If this script is stored in a file called arch, what would be the effect of running this shell command:
./arch novel draft
c) Describe the underlying design principle behind the Linux command set - often called the "UNIX philosophy".
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started