How To Use opt In Bash Script,Example
How To Use opt In Bash Script,Example
This is an exmaple of how to create bash script with Opt in.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/bin/bash
echo "Select no. for option"
OPTIONS="Hello LinuxTribe Quit"
select opt in $OPTIONS; do
if [ "$opt" = "Quit" ]; then
echo done
exit
elif [ "$opt" = "Hello" ]; then
echo Hello World
elif [ "$opt" = "LinuxTribe" ]; then
echo "Welcome in LinuxTribe"
else
clear
echo bad option
echo "Type no. 1,2 or 3 for Hello,LinuxTribe and Quit options respectively"
fi
done
|
No comments:
Post a Comment