HI All..
below is my menu options script. in option 2,3 and 4 im giving input and they are saving into their respective text file.
problem is when im trying to "cat" those files in options 7,8 and 9 im not getting the output. no respective file contents are displaying on screen. but if i run option 7, 8 and 9 code in seperate scripts, im getting perfect output. but when i integrate them in menu choose script, they are not displaying.
can any one guide me and fix this issue....
#!/bin/bash
#Script to create menus and take action according to that selected menu item.
while :
do
clear
echo "---------------------------------------------------------------------------"
echo " * * * * * * * * * * Main Menu * * * * * * * * * * "
echo "---------------------------------------------------------------------------"
echo "[1] Set Udername and password for devices in format username:pasword"
echo "[2] Set Destination path to where Device Backups should SAVE"
echo "[3] Set eMail ID to whom alerts should send"
echo "[4] Add new device to devices list "
echo "[5] View Current Script runing directory"
echo "[6] open VI TEXT Editor"
echo "[7] View Current Device list"
echo "[8] View Current Destination Path"
echo "[9] View Current mail ID set for Alerts"
echo "[0] Exit/stop"
echo "---------------------------------------------------------------------------"
echo -n "Enter your menu choice [1-9]:"
read yourch
#-------------------Start Functions--------------------------------------
case $yourch in
1) read -p "Enter user credentials in format username:password
> " myname
echo "$myname" > /root/script/credentials.txt ;;
2) read -p "Enter Destination path
> " destpath
echo "$destpath" > /root/script/dest_path.txt ;;
3) read -p "Enter E-Mail ID
> " mailid
echo "$mailid" > /root/script/mail_alert.txt ;;
4) read -p "Enter new device details in format device:ipadd
> " dev
echo "$dev" >> /root/script/device_info.txt ;;
5) echo "Script Files are executing from below path"; pwd ; echo "Press a key. . ." ; read -n 1 ;;
6) vi ;;
7) FILE="/root/script/device_info.txt"
echo "*** File - $FILE contents ***"
cat $FILE ;;
8) FILE="/root/script/dest_path.txt"
echo "*** File - $FILE contents ***"
cat $FILE ;;
9) FILE="/root/script/mail_alert.txt"
echo "*** File - $FILE contents ***"
cat $FILE ;;
0) exit 0
;;
*) echo "Opps!!! Please select choice 1-9 or 8"
echo "Press a key. . ."
read -n 1
;;
esac
done