LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 03-26-2007, 10:42 PM   #1
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
Bash Reports Scripting Errors Where There Are None


I've noticed that bash sometimes reports scripting errors where there are none. I've got a complicated script, and I'm sure that it has no errors anymore. Or at least not the same errors it's reporting. What I can't garuntee, is that somewhere in the file structure itself, there are not errors. But in any case, I've seen it come and go with the same contents, so I know that as long as I didn't accidently change it in a bad way, there are no errors.

It does effect the system however. It makes the files malfunction horribly. Does anybody know why bash does this and how to tell it it has no errors? I'm using SuSE Linux 9.0.
 
Old 03-26-2007, 10:55 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

If bash is telling you there's errors, then there's errors. Bash should know, since it's the interpreter.

You might gain some insight by changing the first line of the script from '#!/bin/bash' to '#!/bin/bash -x'. That will print each line as it runs.

Dave
 
Old 03-27-2007, 10:09 PM   #3
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
Thanks! I'll try that!
 
Old 03-28-2007, 02:26 AM   #4
omnio
Member
 
Registered: Feb 2007
Location: $HOME
Distribution: Hardened Gentoo
Posts: 66
Blog Entries: 1

Rep: Reputation: 16
Also make sure to quote the variables everytime is possible (be prepared for white spaces), and to enclose them in curly braces (a non-enclosed variable may confuse bash even when there are no strong reasons for this). But yes, if bash reports errors, there are errors.
 
  


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 scripting vinoth.ilango Solaris / OpenSolaris 6 10-29-2004 04:41 AM
[DNS->Experts] Need help setting them up, reports show many errors Aziz Linux - Networking 5 10-06-2004 03:49 PM
HELP with BASH scripting atwah Linux - Newbie 6 09-09-2003 01:10 AM
Gimp-1.2.3 'make' reports syntax errors GabeF Linux - Software 2 06-11-2003 08:29 PM
Bash scripting NSKL Linux - General 2 06-08-2002 12:10 PM

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

All times are GMT -5. The time now is 03:47 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