The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to find Dependent libraries in ELF file? ravinder.are Filesystems, Disks and Memory 3 04-04-2008 06:23 AM
Dependent Object Framework 0.9 (Default branch) iBot Software Releases - RSS News 0 02-04-2008 08:10 PM
Script execution dependent upon a file landing in a certain directory keladar Shell Programming and Scripting 3 12-27-2007 06:19 PM
E:348 no string under cursor error comes in vi editor in cygwin mrityunjay22 Shell Programming and Scripting 0 12-25-2007 05:52 AM
Job dependent on other job pankajkrmishra Shell Programming and Scripting 4 09-10-2006 11:26 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-16-2006
Registered User
 

Join Date: Jan 2006
Posts: 125
Editor dependent error?

Hi all,

i did typed the following code in vi and executed it.
#!/bin/sh
//notice the blank line here.
DATA=test
echo "$DATA"

There was no problem.

I then deleted the file using the rm command. I used ultraedit typed in the same file. , FTP it in and i got the following output
: command not found
test

I then edited the file using ultraedit, and removed the blank line, this time, i did not get the " command not found error".
i re tried on ultra edit, this time the following piece of code:
#!/bin/sh
//notice the blank line here.
//notice the 2nd blank line here.
DATA=test
echo "$DATA"

the output i got was
: command not found
: command not found
test


It seems the number of blank lines i entered using ultraedit will cause the corresponding number of :command not found message when i executed the script. However, this does not happen when i use vi. Any insights?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-16-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,662
After you ftp the script, do a dos2unix on the script, and then run it.

The reason could be the extra \r characters at the end of each line.
Reply With Quote
  #3 (permalink)  
Old 02-16-2006
Registered User
 

Join Date: Jan 2006
Posts: 125
Thanks for pointing out the cause, Vino.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0