By Ramesh M
#!/bin/ksh
if [ $# -lt 2 ]
then
echo “Usage : $0 Signalnumber PID”
exit
fi
case “$1” in
1) echo “Sending SIGHUP signal”
kill –SIGHUP $2
;;
2) echo “Sending SIGINT signal”
kill –SIGINT $2
;;
3) echo “Sending SIGQUIT signal”
kill –SIGQUIT $2
;;
9) echo “Sending SIGKILL signal”
kill –SIGKILL $2
;;
*) echo “Signal number $1 is not processed”
;;
esac
./file 9 89876
Output :./file[21]: bad option(s)
I cant kill the process, getting the above error :confused:
Task 2:
When Im tring script called char that checks a single character on the
command line, c. If the character is a digit, digit is displayed. If the
character is an upper or lowercase alphabetic character, letter is
displayed. Otherwise, other is displayed. Have the script print an
error message if the argument c is more than one character in length.
Gimme some idea to reform(correct structure) this below code for the above task
#!/bin/ksh
c=$1
if [[ c -le 9 ]]
then
echo “Proceed “
elif [[ c -eq a-z ]]
then
echo “alphabet”
else
echo “More than one char in length”
fi
case $1 in
1-9) echo “The value is a number”
;;
a-z) echo “the value is a alphabet”
;;
*) echo “Other”
;;
esac
…read more
Source: FULL ARTICLE at The UNIX and Linux Forums