#! /bin/bash
#process the command line argument using getopts
#take action based on input
while getopts :h:r:l: OPTION
do
case $OPTION in
h)
echo "help of $OPTARG"
help "$OPTARG"
;;
r)
echo "Going to remove a file $OPTARG"
rm -f "$OPTARG"
;;
*)
echo "Unknown option"
echo "Usage: sh getopt.sh [-hrl] [value]"
;;
esac
done
#process the command line argument using getopts
#take action based on input
while getopts :h:r:l: OPTION
do
case $OPTION in
h)
echo "help of $OPTARG"
help "$OPTARG"
;;
r)
echo "Going to remove a file $OPTARG"
rm -f "$OPTARG"
;;
*)
echo "Unknown option"
echo "Usage: sh getopt.sh [-hrl] [value]"
;;
esac
done
No comments:
Post a Comment