OSY OUTPUT 10 TO 13
OSY OUTPUT 10 TO 13
10
Q. Execute Shell Script by using if statement.
OUTPUT
OUTPUT
OUTPUT
terminal@terminal ~$ Desktop/Shell$ chmod ugo+x evenodd.sh
terminal@terminal ~$ Desktop/Shell$ ./evenodd.sh
odd
even
odd
even
odd
even
odd
terminal@terminal ~$ Desktop/Shell$
PRACTICAL NO .12
Q.Write Shell Script to find out whether – Given file exists?
read file
if [ -f "$file" ]
then
echo "$file It is a file"
else
if [ -d "$file" ]
then
echo "$file It is a directory"
fi
OUTPUT
terminal@terminal ~$ Desktop/Shell$ mkdir ul
terminal@terminal ~$ -/Desktop/Shell$ ls case.sh double.sh
execpwd.sh f
dir.sh evenodd.sh exec.sh file.sh greatest.sh login.sh fibo.sh for.sh
pattern.sh permission.sh single.sh table.sh week.sh lessthan.sh
multiple.sh patt.sh san.sh sun.sh 01
terminal@terminal ~$ /Desktop/Shell$ ./dtr.sh
Enter file or directory name:
U1 ul is a directory
terminal@terminal ~$ Desktop/Shell$ ./dtr.sh
Enter file or directory name:
multiple.sh
multiple.sh is a file
PRACTICAL NO .13
Q. Write a shell script to find out whether - File has read, write and execute
permissions.