LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-05-2004, 09:15 PM   #16
illtbagu
Member
 
Registered: Dec 2002
Location: Nevada
Distribution: fedora, RHEL, ubuntu, suse
Posts: 343

Original Poster
Rep: Reputation: 30

One of the big problems I have with bash is skipping sections of the script of certian conditions apply. For instance if this was a windows batch script I could just use the GOTO statement and I an skip complete sections of the batch script if I like. I have not figured out how to do this with bash.

micxz,

your code worked great thanks. I don't understand why though. It was just an extra "fi" that seemed to do the trick. Also you were using "if" instead if "elif" when there is multiple conditions. I thought that it should be "elif" if multiple conditions applied.


dustu76,
Code:
[ -d /opt/kde3/share/apps/konqueror/servicemenus ] && echo "Looks Like SuSE."
[ -z "$KDEDIR" ] && export KDEDIR=/opt/kde3
Thanks for your help. Your code got me thinking though. statement1 && statement2 will not work in my situation. Correct me if I am wrong but statement2 will run no matter what the outcome of statement1 is. Statement2 should only echo if statement 1 is false.

I would think it would be more like
Code:
if [ -d /opt/kde3/share/apps/konqueror/servicemenus ]; then echo "Looks Like SuSE."
if [ -z "$KDEDIR" ];then echo "Lets create a enviorment varibale for KDE." &&  export KDEDIR=/opt/kde3
The whole problem I have had is tying the condition in that if its SuSE and the the env. variable $KDEDIR doesn't exist then it should be created. This part of the script must be kept from getting executed if the distro is not SuSE.


I have not completely finished this up yet but thanks for all of your help guys : )
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
expert help needed with bash and bc karistouf Programming 5 06-22-2005 01:55 AM
X11 Expert Needed hilltop*Tech Linux - Hardware 4 06-10-2005 10:11 AM
Expert help with iptables needed k1mgy Linux - Networking 2 08-01-2004 08:21 AM
Fdisk Expert !! Badly needed mickeyboa Fedora 1 07-18-2004 09:52 PM
Security Expert needed Lloydlec Linux - Security 1 04-27-2004 12:45 PM

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

All times are GMT -5. The time now is 01:47 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration