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
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