My First Shell Script


Hi all,

Below is my first shell script to read the “.conf” files in given folder and let the user select one of the file or to select all of the file. This script is half part of a application that read the different configure files in Linux Based system and allow user to use any one of the to run a particular application with that conf file

so here is that select script


Result=`ls|grep \.conf$`
echo “Select a file to execute”
select file in $Result All
do
break
done
echo “You have selected $file”
case $file in
All)
echo $Result;;
*)
if [[ -e $file ]];then
echo “Yeppy file exists”;cat $file
else
echo “Some Error has occured”
fi;;
esac

Enjoy my First Linux Shell Script … Please do suggest me if I does anything wrong or if there is any optimization possible in this..

Sumit Gupta