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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!