Re: How to suppress warning messages for empty lines in shell scripts?



In article <48418830$0$6551$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
buzzuz@xxxxxxxxxxx (Jochen Berninger) wrote:

From the command line I called (with nohup) a shell script which contains
empty lines
(for better readability).

The nohup executes the script successfully but outputs a warning for the
empty line:

/usr/local/joch/bin/dotest: line 3:
: command not found

How can I suppress this warning (of cause without removing the empty line)?

Do I really have to always avoid empty lines in shell scripts?

No, empty lines are fine in shell scripts.

I suspect what you actually have a are CR LF pairs as newlines, instead
of just LF, because you wrote the file on a Windows machine and
transferred it to Unix. Use dos2unix to fix it.

--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.



Relevant Pages

  • Re: Merging Tables
    ... OK - try going to the first row of a table that starts on something other ... indicate a bunch of empty paragraphs separating the ... It is very common for these scripts to have a lot of half used ... (Show/Hide ¶ doesn¹t reveal any hard break) ...
    (microsoft.public.mac.office.word)
  • Re: Security Update MS06-015 - Fix
    ... trust it implicitly. ... It didn't help with some 'dipstick' mentioning a 'file being empty' ... A confirmation? ... Are you asking whether it's safe to use Kelly's scripts?. ...
    (microsoft.public.windowsxp.general)
  • Re: rmdir permission errors on a Windows box
    ... >> have anywhere else to test my scripts), ... >> folders, which completely mystifys me. ... Yes the directories are empty, what this part of my script does is ... All the files get removed but even the most bottom level directories ...
    (comp.lang.php)
  • Re: update same row
    ... All the scripts I use are created for 90% by somebody else and I adjusted ... "Michael Bauer" wrote: ... >> if that cell is empty. ... >> Thank you for your help Michael! ...
    (microsoft.public.outlook.program_vba)
  • Re: perl warnings
    ... The first time it runs, parameter 'action' isn't defined so that is ... print "\$action is empty"; ... Use of uninitialized value in string eq at -e line 7. ... )' but that still produces a warning. ...
    (perl.beginners)