LINUX If Else
LINUX If Else
read emp_no
read emp_name
read hra
read ta
read b_sal
then
srm="Senior manager"
then
m= "Manager"
echo $emp_no"|"$emp_name"|" $gross_sal"|" $m >> cat > info
then
else
echo "Error"
fi
Q2. Write a shell script to write down conditions accept option from
user.
1. show no of user.
2. showing current working dir.
3. file details in long list.
read opt
case $opt in
1) who;;
2) pwd;;
3) ls -l;;
esac
Q3 Write a shell script to accept a filenm. if does not exists. create
it show the no of lines andwords of the file save in variable display
its content.
read a
if test -e $a
then
cat $a
wc -l $a
wc -w $a
else
read c
cat > $c
cat $c
wc -l $c
echo "Total word count : "
wc -w $c
fi