LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-19-2008, 05:47 AM   #1
hellreaper
LQ Newbie
 
Registered: Feb 2008
Posts: 5

Rep: Reputation: 0
BASH script with case ( mandriva )


Hello everyone,
I am getting an error with my case and i dont really understand why, the ligne were i get my error is: case $choice in q) (ligne 24)
if someone has any idea please help me out!
thanks
here is my script:

#!/bin/bash
let "loop=0"
while test $loop == 0
do
clear
echo "Choisissez la lettre du menu auquel vous souhaitez accèder puis appuyez sur entrer"
echo "------------------------------------------------------"
echo "a. Gestion des utilisateurs et des groupes"
echo "b. Gestion du réseau"
echo "c. Gestion de l'heure système"
echo "d. Montage de volumes réseau"
echo "e. Planification de tâches"
echo "f. Gestion des disques"
echo "g. Gestion du fstab"
echo "h. Gestion des modules du kernel"
echo "i. Affichage de statistiques systèmes"
echo "j. Gestion de la langue"
echo "k. Gestionnaire de packages"
echo "------------------------------------------------------"
echo "q. quit"
echo "choice?"
read choice

case $choice in q)
let "loop=1"
esac
case $choice in a)
echo "Gestion des utlisateurs et des groupes"
let "loop=0"
while test $loop == 0
do
clear
 
Old 02-19-2008, 05:54 AM   #2
hellreaper
LQ Newbie
 
Registered: Feb 2008
Posts: 5

Original Poster
Rep: Reputation: 0
I dont understand i am using VMWARE workstation when i drag and drop the file in my VM it wont work! wereas if i copy the text on windows and paste it in mandriva editor it works!! i really dont understand....
 
Old 02-19-2008, 06:05 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
- "while" and "for" loops use syntax "for item in items; do action; done".
- "case" statements use syntax "case string in substring0) action;; substring1) action;; esac".
- Group your choices in one case statement. In this case a "select" menu could be easier.
- "while test loop do clear" makes no sense. Printing a message should make it more clear what you've done.
- If you have errors first try debugging the script as 'sh -evx scriptname'. If that doesn't give you ideas read a tutorial to understand better.
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.tldp.org/LDP/Bash-Beginne...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
Old 02-19-2008, 07:36 AM   #4
hellreaper
LQ Newbie
 
Registered: Feb 2008
Posts: 5

Original Poster
Rep: Reputation: 0
ok thank you for your quick reply!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash: change case graemef Programming 9 04-06-2010 08:48 PM
Case Insenseitive bash shell shan_nathan Linux - General 2 10-26-2007 11:20 AM
bash : change first character to upper case powah Programming 5 07-18-2007 08:18 PM
The case of the disappearing bash history geomatt Linux - General 5 03-02-2005 04:08 PM
Bash case structure (looping) ravvar Programming 4 10-07-2003 07:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration