Question: Revision question 2 on Linux. Please briefly explain your shell scripts and commands. You have just logged in and have a directory called experiment in

Revision question 2 on Linux. Please briefly explain your shell scripts and commands.

You have just logged in and have a directory called "experiment" in your home directory containing the following files:

analysis.java paper.rtf paper.pdf raw

where "raw" is itself a directory and contains the files:

2015-01-10.dat 2015-02-11.dat 2015-03-24.dat 2015-04-06.dat exper1.txt exper2.txt exper3.txt exper4.txt

a) Describe the results you would expect when executing the following shell commands:

i) ls experiment/raw/*4*

ii) ls experiment/*/*0[23]*

iii) rm -r experiment

iv) ls experiment | wc -l

v) rmdir experiment/raw

(assume each command is run when the directory "experiment" is as described above)

b) Consider the following short shell script:

#!/bin/sh

cd $1

for i in */*.$2

do

if [ `wc -c $i ` -gt $3 ]

then

chmod a+r $i

fi

done

If this script is stored in a file called mung, what would be the effect of running this shell command:

./mung experiment txt 1000

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!