Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
: - 2
Declaration:
I declare that this assignment is my individual work. I have not copied from
any other student’s work or from any other source except where due
acknowledgment is made explicitly in the text, nor has any part been written
for me by another person.
Student’s Signature
Yogendra Singh
Evaluator’s comments:
______________________________________________________________
_______
Marks obtained : ___________ out of ______________________
Ans: linux script does not support comparison between greater that(>) or lesser
than(<) are used to redirect output of a command or action somewhere else Or Instead
of < or > Linux scripts have “-lt” for < and “-gt” for > .
For example:
echo enter two nos
read x y
if [ $x –gt $y ]
then
echo x is greater
else
echo y is greater.
fi
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/boot: this is a directory that contains the boot loader files like Grub.
Grub is dynamically configurable and it is load at the time of startup.
GRUB provides a simple, command line interface which lets users write new boot
sequences. GRUB is highly portable. It supports multiple executable formats, and is
geometry translation independent.
/temp: a temporary file system which hold temporary files which are cleared at system
reboot.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2. Write a shell script having the same name as your roll no.
It should input the source and destination directory
names and copy only the files from source to destination.
If it encounters subdirectory, it should not copy and
provide appropriate message for the same.
Ans:
vi rc1912a19
echo enter the source directory name
read sdn
echo enter the destination directory name
read ddn
if [ -f $sdn && -f $ddn]
then
echo the file $sdn and $ddn exist and it is not a directory you cannot copy these files.
else
cp –r $sdn $ddn
echo the files exist and they are copied
fi
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3) //(c) Delete the files with the name starting as junk from
the directory//
delete junk*;;
4 ) // (d) to exit //
exit(0);;
*)
break;;
esac