I just tried a simple menu based shell script to get the public ip of my system. using ( curl ifconfig.me ) .. but I found it behaving differently.
here I tried with:
anupam@JAZZ:~/Desktop$ cat menuui
#
# Script to create simple menus and take action according to that selection
# menu item
#
while :
do
clear
echo "___________________________________"
echo "Main Menu"
echo "___________________________________"
echo "[1] Show Today's date/time"
echo "[2] Show files in current directory"
echo "[3] Show calendar"
echo "[4] Start a calculator"
echo "[5] Start editor to write letters"
echo "[6] Show your public ip"
echo "[7] Exit/Stop"
echo "===================================="
echo -n "Enter your menu choice[1-5]:"
read yourch
case $yourch in
1) echo "Today is `date` ,press a key..." ; read ;;
2) echo "Files in `pwd` "; ls -l;echo "Press a key..."; read;;
3) cal; echo "Press a key..." ; read ;;
4) bc;;
5) vi;;
6) echo "Your public ip is `curl ifconfig.me`";;
7) exit 0 ;;
*) echo "Opps!!! Please select choices 1,2,3,4 or 5";
echo "Press a key...";read;;
esac
done
then I executed it...
which is not I expected..How could I resolve this??
Use
curl
with-s
option. Fromman curl
It will not show the additional details such as progress meter or error messages. The modified statement will look like,
$()
is better to use than command substitution quotation``