Sponsored Content
Top Forums Shell Programming and Scripting Bash Script: Trouble unable to run Post 302335902 by RiSk on Monday 20th of July 2009 06:01:26 PM
Old 07-20-2009
Quote:
Originally Posted by rchirico
Joe,
Thanks for your help. I still can't get it to work. Funny thing though, when I comment out options 6 & 7, it works. I tried deleting the line, and re-typing it to no avail. Something about the parenthesis 6) is giving me an error. That parenthesis appears as a different color other than options 1-5.

Thanks,

Rob

rchirico, its because you did not close off number 5 with a ;;, copy and paste mine and try it. I know it works Smilie


Code:
risk@Heavyarms [238] --> cat ./test.sh
#!/bin/bash
# Cool Script for Weekly Assignment 2 (#3) that creates a menu to act as a ui
# and run some popular commands.
clear
while :
  do
     clear
     echo "**************************************************"
     echo " Main Menu of Linux User Interface"
     echo " Today's Date and Time: " `date`
     echo "**************************************************"



     echo "[1] Display Calendar for current year"
     echo "[2] Show files in your home directory"
     echo "[3] Launch vi to create/edit a file"
     echo "[4] Shutdown system now"
     echo "[5] Shutdown system in 5 minutes"
     echo "[6] Show files in current directory"
     echo "[7] Exit/Stop"
     echo "******************************"
     echo -n "Please enter your menu choice [1-7] : "
     read choice
     case $choice in
       1) echo `cal -y`; echo "Press any key ..."; read ;;
       2) echo "Files in `$HOME`" ; ls -l ; echo "Press any key ..." ; read ;;
       3) vi ;;
       4) clear
          echo " "
          echo " "
          read -p "Are you sure you want to shut down? - Y/N: " choice
          if [[ "$choice" = 'Y' ]] ; then
          sudo shutdown -h now
          fi
          clear ;;
       5) sudo shutdown -h now ;;
       6) echo "Files in `pwd`"; ls -l ; echo "Press any key ..."; exit ;;
       7) exit 0 ;;
       *) echo "Invalid selection!!!  Please select choice 1,2,3,4,5,6, or 7";
          echo "Press any key ..." ; read ;;

esac
done
-(~/fun/unixforums)--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(16:46 Mon Jul 20)
risk@Heavyarms [239] --> sh ./test.sh
**************************************************
 Main Menu of Linux User Interface
 Today's Date and Time:  Mon Jul 20 16:46:15 CDT 2009
**************************************************
[1] Display Calendar for current year
[2] Show files in your home directory
[3] Launch vi to create/edit a file
[4] Shutdown system now
[5] Shutdown system in 5 minutes
[6] Show files in current directory
[7] Exit/Stop
******************************
Please enter your menu choice [1-7] : ^C
-(~/fun/unixforums)--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(16:46 Mon Jul 20)
risk@Heavyarms [240] -->

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unable to run a script

thi is (10 Replies)
Discussion started by: angelina
10 Replies

2. Shell Programming and Scripting

how to make your bash script run on a machine with csh and bash

hi, i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
Discussion started by: npatwardhan
3 Replies

3. Shell Programming and Scripting

unable to run mono app using .sh script

I did a search for this problem but couldn't find any specific answers to my problem. We have a .NET application compiled in SharpDevelop for Mono which we want to execute with a .sh shell script on Ubuntu. When we execute the script nothing happens meaning the application's visual interface... (0 Replies)
Discussion started by: JacquesB
0 Replies

4. Shell Programming and Scripting

Quoting issue: Trouble with bash strings in script

I can do this on the command line: sqsh -S 192.168.x.x -o tmp -U user -P fakepass -D horizon -C "\ select second_id from borrower where btype like '%wsd%' " I can also just leave the SQL at the end intact on one line .... ... However, when I throw this in a script like: $SQSH -o... (4 Replies)
Discussion started by: Bubnoff
4 Replies

5. SuSE

Unable to Run a script at startup in suse

Hi I have a script myscript.sh that needs to be run whenever the server boots. The script is actually logging Syslog-ng messages to sql server. I need to lauch it at startup I have copied the script in etc/init.d i have also added the link ln -s /etc/init.d/syslog-ng-mssql-pipe.sh... (5 Replies)
Discussion started by: SystemEng
5 Replies

6. Shell Programming and Scripting

php file unable to run shell script with arguments

echo $result=exec("./permit.sh".$_FILES); pls suggest some other method to run shell script in php .:wall::mad: (0 Replies)
Discussion started by: upvan111
0 Replies

7. Programming

CGI Perl script to execute bash script- unable to create folder

Hi I have a bash script which takes parameters sh /tmp/gdg.sh -b BASE-NAME -n 1 -s /source/data -p /dest/data/archive -m ARC gdg.sh will scan the /source/data and will move the contents to /dest/data/archive after passing through some filters. Its working superb from bash I have... (0 Replies)
Discussion started by: rakeshkumar
0 Replies

8. Shell Programming and Scripting

Having trouble with My Bash Script, need Help debugging

Hello Friends I am having trouble with my script below. I will describe the problems below the code box. I am hoping that some of the experts here can help me. #!/bin/bash #========================================================================================================= # Rsync File... (8 Replies)
Discussion started by: jdavis_33
8 Replies

9. Homework & Coursework Questions

Linux/UNIX Bash Shell Script trouble help needed!!

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 2. Shell Bash Script 3. !/bin/bash if echo no directory then mkdir -p /home/AC_Drywall elif ; then echo "$dir already exist" fi (4 Replies)
Discussion started by: TomFord1
4 Replies

10. UNIX for Advanced & Expert Users

Unable to run the script on remote machine Using Expect script

Not able to execute the file in remote host using except utility I am automating the SFTP keys setp process: So i created the expect script for controlling the output of shell below is my main code: Code: #!/usr/bin/expect set fd set password close $fd set df set app close $df... (1 Reply)
Discussion started by: Manoj Bajpai
1 Replies
SCRIPT-EMAIL(8) 					  System Administration Commands					   SCRIPT-EMAIL(8)

NAME
script-email - Amanda script to send email notifications DESCRIPTION
script-email is an Amanda script implementing the Script API. It should not be run by users directly. It sends a notification email to the addresses specified in the MAILTO property. PROPERTIES
This section lists the properties that control script-email's functionality. See amanda-scripts(7) for information on the Script API, script configuration. MAILTO List of email addresses that will receive an email on command execution. It is a multi-valued property: property "MAILTO" "amanda@domain.com" "sysadmin@domain.com" "amandauser@domain.com" EXAMPLE
In this example, script-email is scheduled to be run before the DLE, on the server. The unqualified email address amanda will be passed to the email system unchanged. The script is then attached to a dumptype, which can then be specified for any DLEs which require notification. define script-tool pre-email { comment "email me before this DLE is backed up" plugin "script-email" execute-on pre-dle-backup execute-where server property "mailto" "amanda" } define dumptype user-tar-email { user-tar script "pre-email" } SEE ALSO
amanda(8), amanda.conf(5), amanda-client.conf(5), amanda-scripts(7) The Amanda Wiki: : http://wiki.zmanda.com/ AUTHORS
Jean-Louis Martineau <martineau@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Dustin J. Mitchell <dustin@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Amanda 3.3.1 02/21/2012 SCRIPT-EMAIL(8)
All times are GMT -4. The time now is 08:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy