Register
It is currently Fri Oct 31, 2014 2:44 pm

Functional script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Fri Apr 24, 2009 1:47 pm   

Joined: Wed Apr 08, 2009 12:41 pm
Posts: 15
I wrote this script but I can't get it to work. What is missing here?

Code:
#!/bin/bash
#PATH=/bin:/usr/bin:/usr/local/bin:.
#export PATH
LOOP=0
while test $LOOP
do
tput clear
echo
echo "    _________________________________________ "
echo "   |              Main Menu                  |"
echo "   |-----------------------------------------|"
echo "   | 1) Print local path of this directory   |"
echo "   | 2) List content of current directory    |"
echo "   | 3) Print who is logged onto this server |"
echo "   | 4) Print who is running this server     |"
echo "   | 0. Quit                                 |"
echo "   |_________________________________________|"
echo
echo -n "          Please Make Selection: "
read SELECT
case $SELECT in
1)   tput clear
   echo "The local path for this directory is:";
   pwd;
    ;;
2)   tput clear
    echo "The content of this directory is:"
   ls -al
    ;;
3)   tput clear
   echo "List of users login to this server:"
   last -ai
    ;;
0)   echo;echo "Returning to command line....."
   exit;;
esac

done

###########################
# functions
###########################
print_local_path() {
# check installation of any previously installed applications

if [ -f ls -al ]
then
   pwd
fi

if [ ! -e pwd ]
then
        ls -al
fi

}


Any help is greatly appreciated.


Top
 Profile  
 PostPosted: Fri Apr 24, 2009 2:35 pm   

Joined: Mon Nov 17, 2008 7:25 am
Posts: 221
Please post the error messages you're getting or what isn't happening.

Hard to look for errors when you have no pointers :)

Best regards
Fredrik Eriksson


Top
 Profile  
 PostPosted: Fri Apr 24, 2009 9:56 pm   

Joined: Wed Apr 08, 2009 12:41 pm
Posts: 15
fredrik.eriksson wrote:
Please post the error messages you're getting or what isn't happening.
I am sorry; I should have made this clear.

The script runs with no errors, but doesn't display/show the results of a command at the bottom of the "Main Menu". SSH to the server, run the script and make a selection; the script will show the results on top of the "Main Menu" and clear the screen very quick. I think there is something wrong with the loop function. Thank you for your help :-)


Top
 Profile  
 PostPosted: Fri Apr 24, 2009 10:47 pm   

Joined: Wed Apr 08, 2009 12:41 pm
Posts: 15
My bad. I found the problem. I need to remove the "tput clear" function. It is working like a champ now. Thank you


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP