LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-25-2009, 08:39 AM   #16
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983

What happens if you run it as
Code:
bash -x sub.sh
please use CODE tags to embed the text copied/pasted from your terminal.
 
Old 08-25-2009, 09:02 AM   #17
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
I still suspect a wrong character somewhere in the script.

Please post the output of the following command (in CODE tags, just as colucix request):

od -c sub.sh
 
Old 08-25-2009, 10:23 AM   #18
neda.hd
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Here is the result from the " bash -x sub.sh" :
Code:
+ $'\r'
: command not found
+ $'\r'
: command not found
+ $'\r'
: command not found 
+ . $'/directory/.profile\r'
: No such file or directorypfo/.profile
+ . $'/directory/rc/fo_svr.rc\r'
: No such file or directoryds/rc/fo_svr.rc
+ $'\r'
: command not found 
+ FEDS=$'/directory/feds\r'
+ FEDSBIN=$'/directory/bin\r'
+ CRON_DIR=$'/directory/cronDir\r'
+ . $'/directory/cronDir\r/scrubReport/MBS_ScrubReport/env.sh\r'
: No such file or directoryt/env.shDir
+ export HOME FEDS FEDSBIN $'LD_LIBRARY_PATH\r'
': not a valid identifiert: `LD_LIBRARY_PATH
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ STARTAPP_DIR=/directory/bin
+ export $'STARTAPP_DIR\r'
': not a valid identifiert: `STARTAPP_DIR
+ OUT_DIR=$'/home/cronDir\r/scrubReport/output\r'
+ LOG_DIR=$'/home/cronDir\r/scrubReport/logs\r'
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ /bin/rm $'/home/cronDir\r/scrubReport/output\r/errors_mbs.csv\r'
: No such file or directory
+ /bin/rm $'/home/cronDir\r/scrubReport/logs\r/logs_mbs.csv\r'
: No such file or directory
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ /startApp -c 1 -m 4048 -w 5 -z 600 -i sbtorsvr57 -s 'cd cronDir/scrubReport/MBS_ScrubReport; scrub.sh'
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ $'--------------------------\r'
: command not found --------------------------
+ $'\r'
: command not found 
+ $'\r'
: command not found 
+ $'\r'
: command not found
Thanks,

Neda.
 
Old 08-25-2009, 10:26 AM   #19
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
The \r is the escape sequence for "carriage return". It looks like this script has been written in a Windows system and transferred to Linux. Carriage returns are a poison for bash. Try to run the following command:
Code:
dos2unix sub.sh
to remove the carriages and re-run the script.
 
Old 08-25-2009, 10:27 AM   #20
neda.hd
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Original Poster
Rep: Reputation: 0
And here is the result of the " od -c sub.sh " :

Code:
0000000   #   !   /   b   i   n   /   s   h  \r  \n  \r  \n  \r  \n   #
0000020   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
0000040   *   *   *   *   *   *   M   a   i   n       s   h   e   l   l
0000060       s   c   r   i   p   t   *   *   *   *   *   *   *   *   *
0000100   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
0000120   *   *   *   *   *   *   *   *   #  \r  \n   #       T   h   i
0000140   s       s   c   r   i   p   t       r   u   n   s       s   u
0000160   b   M   a   i   n   .   c   p   p       w   h   i   c   h    
0000200   r   u   n   s       t   h   e       R   m   d   s   U   t   i
0000220   l   .   c   p   p       a   n   d       g   e   n   e   r   a
0000240   t   e   s       #  \r  \n   #       o   u   t   p   u   t    
0000260   f   i   l   e   s       l   o   g   _   m   b   s   .   c   s
0000300   v                                                            
0000320                                                                
*
0000360   #      \r  \n   #       a   n   d       e   r   r   o   r   s
0000400   _   m   b   s   .   c   s   v   .       e   r   r   o   r   s
0000420   _   m   b   s   .   c   s   v       c   o   n   t   a   i   n
0000440   s           d   e   t   a   i   l   s       o   f       t   h
0000460   e       C   M   T   S       b   o   n   d   s       #  \r  \n
0000500   #       w   i   t   h       e   r   r   o   r   s       i   n
0000520       t   h   e   i   r       s   a   v   e   d       l   e   v
0000540   e   l   s   .                                                
0000560                                                                
0000600                                       #  \r  \n   #   *   *   *
0000620   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
*
0000720   *   *   *   *   *   #  \r  \n  \r  \n   .       $   H   O   M
0000740   E   /   .   p   r   o   f   i   l   e  \r  \n   .       /   b
0000760   n   s   /   f   e   d   s   /   r   c   /   f   o   _   s   v
0001000   r   .   r   c  \r  \n      \r  \n   F   E   D   S   =   /   b
0001020   n   s   /   f   e   d   s  \r  \n   F   E   D   S   B   I   N
0001040   =   /   b   n   s   /   f   e   d   s   /   b   i   n  \r  \n
0001060   C   R   O   N   _   D   I   R   =   $   H   O   M   E   /   c
0001100   r   o   n   D   i   r  \r  \n   .       $   C   R   O   N   _
0001120   D   I   R   /   s   c   r   u   b   R   e   p   o   r   t   /
0001140   M   B   S   _   S   c   r   u   b   R   e   p   o   r   t   /
0001160   e   n   v   .   s   h  \r  \n   e   x   p   o   r   t       H
0001200   O   M   E       F   E   D   S       F   E   D   S   B   I   N
0001220       L   D   _   L   I   B   R   A   R   Y   _   P   A   T   H
0001240  \r  \n  \r  \n   #       d   e   f   i   n   e       t   h   e
0001260       d   i   r   e   c   t   o   r   y       n   e   e   d   e
0001300   d       w   h   e   r   e       c   r   o   n       s   t   u
0001320   f   f       i   s       f   o   u   n   d   .           E   r
0001340   r   o   r       m   e   s   s   a   g   e   s       a   n   d
0001360  \r  \n   #       l   o   g   s       a   r   e       p   u   t
0001400       i   n       t   h   e       "   l   o   g   s   "       s
0001420   u   b   d   i   r   e   c   t   o   r   y  \r  \n  \r  \n   S
0001440   T   A   R   T   A   P   P   _   D   I   R   =   /   h   o   m
0001460   e   /   a   d   r   a   g   a   l   i   /   p   r   o   j   e
0001500   c   t   s   /   l   b   a   l   a   n   c   e   r   /   b   i
0001520   n       e   x   p   o   r   t       S   T   A   R   T   A   P
0001540   P   _   D   I   R  \r  \n   #   S   T   A   R   T   A   P   P
0001560   _   D   I   R   =   $   H   O   M   E   /   a   d   r   a   g
0001600   a   l   i   /   p   r   o   j   e   c   t   s   /   l   b   a
0001620   l   a   n   c   e   r   /   b   i   n       e   x   p   o   r
0001640   t       S   T   R   A   T   A   P   P   _   D   I   R  \r  \n
0001660   O   U   T   _   D   I   R   =   $   C   R   O   N   _   D   I
0001700   R   /   s   c   r   u   b   R   e   p   o   r   t   /   o   u
0001720   t   p   u   t  \r  \n   L   O   G   _   D   I   R   =   $   C
0001740   R   O   N   _   D   I   R   /   s   c   r   u   b   R   e   p
0001760   o   r   t   /   l   o   g   s  \r  \n  \r  \n   #   -   -   -
0002000   -   -   -   -   -   -   -   R   u   n   n   i   n   g       s
0002020   u   b   M   a   i   n   .   c   p   p       a   n   d       r
0002040   e   d   i   r   e   c   t   i   n   g       t   h   e       o
0002060   u   t   p   u   t   -   -   -   -   -   -   -   -   -   -   -
0002100   -   -  \r  \n  \r  \n   /   b   i   n   /   r   m       $   O
0002120   U   T   _   D   I   R   /   e   r   r   o   r   s   _   m   b
0002140   s   .   c   s   v  \r  \n   /   b   i   n   /   r   m       $
0002160   L   O   G   _   D   I   R   /   l   o   g   s   _   m   b   s
0002200   .   c   s   v  \r  \n  \r  \n  \r  \n   $   {   S   T   A   R
0002220   T   A   P   P   _   D   I   R   }   /   s   t   a   r   t   A
0002240   p   p       -   c       1       -   m       4   0   4   8    
0002260   -   w       5       -   z       6   0   0       -   i       "
0002300   s   b   t   o   r   s   v   r   5   7   "       -   s       "
0002320   c   d       c   r   o   n   D   i   r   /   s   c   r   u   b
0002340   R   e   p   o   r   t   /   M   B   S   _   S   c   r   u   b
0002360   R   e   p   o   r   t   ;       s   c   r   u   b   .   s   h
0002400   "   >   /   h   o   m   e   /   d   p   f   o   /   c   r   o
0002420   n   D   i   r   /   s   c   r   u   b   R   e   p   o   r   t
0002440   /   l   o   g   s   /   l   o   g   s   _   m   b   s   .   c
0002460   s   v       2   >   /   h   o   m   e   /   d   p   f   o   /
0002500   c   r   o   n   D   i   r   /   s   c   r   u   b   R   e   p
0002520   o   r   t   /   o   u   t   p   u   t   /   e   r   r   o   r
0002540   s   _   m   b   s   .   c   s   v  \r  \n  \r  \n  \r  \n  \r
0002560  \n  \r  \n  \r  \n  \r  \n  \r  \n  \r  \n   -   -   -   -   -
0002600   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
0002620   -   -   -   -   -  \r  \n  \r  \n   #   (  \r  \n   #   .   /
0002640   s   u   b   M   a   i   n   2       /   b   n   s   /   d   e
0002660   r   i   v   P   r   o   d   D   a   t   a   /   f   i   x   e
0002700   d   I   n   c   o   m   e   D   a   t   a   /   T   S   X   /
0002720   e   x   t   r   a   c   t   s   /   t   s   x   .   b   o   n
0002740   d   _   q   u   o   t   e   s   .   c   s   v  \r  \n   #   /
0002760   h   o   m   e   /   L   B   a   r   b   u   l   o   v   i   c
0003000   N   a   d   /   S   c   r   u   b       R   e   p   o   r   t
0003020   s   /   L   i   v   e   /   M   B   S       R   e   p   o   r
0003040   t   .   x   l   s  \r  \n   #   )   >   >       /   h   o   m
0003060   e   /   n   h   e   i   d   a   /   l   o   g   _   M   B   S
0003100   .   c   s   v       2   >   >   /   h   o   m   e   /   n   h
0003120   e   i   d   a   /   e   r   r   o   r   s   _   M   B   S   .
0003140   c   s   v  \r  \n  \r  \n   #   /   b   i   n   /   r   m    
0003160   /   h   o   m   e   /   n   h   e   i   d   a   /   o   u   t
0003200   p   u   t   /   e   r   r   o   r   s   _   m   b   s   .   c
0003220   s   v  \r  \n   #   /   b   i   n   /   r   m       /   h   o
0003240   m   e   /   n   h   e   i   d   a   /   o   u   t   p   u   t
0003260   /   l   o   g   _   m   b   s   .   c   s   v  \r  \n  \r  \n
0003300   #   (   .   /   s   u   b   M   a   i   n       /   b   n   s
0003320   /   d   e   r   i   v   P   r   o   d   D   a   t   a   /   f
0003340   i   x   e   d   I   n   c   o   m   e   D   a   t   a   /   T
0003360   S   X   /   e   x   t   r   a   c   t   s   /   t   s   x   .
0003400   m   b   s   _   q   u   o   t   e   s   .   c   s   v   )    
0003420   >   >       /   h   o   m   e   /   n   h   e   i   d   a   /
0003440   o   u   t   p   u   t   /   l   o   g   _   m   b   s   .   c
0003460   s   v       2   >   >   /   h   o   m   e   /   n   h   e   i
0003500   d   a   /   o   u   t   p   u   t   /   e   r   r   o   r   s
0003520   _   m   b   s   .   c   s   v  \r  \n
0003532
Thanks,

Neda.
 
Old 08-25-2009, 10:33 AM   #21
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
If for some reason you don't have the dos2unix command, you can also use:
Code:
sed -i 's/\r//g' sub.sh
 
Old 08-25-2009, 10:33 AM   #22
neda.hd
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Unhappy Command not found

"dos2unix sub.sh" didn't seem to work. It did not remove the carriages.

Regards,

Neda.
 
Old 08-25-2009, 10:38 AM   #23
neda.hd
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Unhappy Command not found

Thanks.
Code:
sed -i 's/\r//g' sub.sh
[/QUOTE]

returned the following ;

Code:
sed: illegal option -- i
[/QUOTE]

What does that means?

Thanks,

Neda.
 
Old 08-25-2009, 10:54 AM   #24
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by neda.hd View Post
Code:
sed: illegal option -- i
What does that means?
That you're not running GNU sed. Which system are you running on? Your best option now is to copy your script from your previous post #9, then paste it as standard input to the command:
Code:
$ cat > new_sub.sh
pasted text here
Ctrl-D
in this way you create a new script that can be further edited and eventually serves as replacement for the original sub.sh file.

Last edited by colucix; 08-25-2009 at 11:07 AM.
 
Old 08-25-2009, 11:54 AM   #25
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
If dos2unix is not available, I tend to use sed:

Code:
sed 's/^M//g' sub.sh > new_sub.sh
The ^M in the above is a single character, generated by pressing:
[Ctrl]+[v] followed by [Ctrl]+[m]

Last edited by Disillusionist; 08-25-2009 at 11:55 AM.
 
Old 08-25-2009, 03:21 PM   #26
neda.hd
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Smile Command not found

Thanks very much for all your help and support.

Yes I had to create a new script.

This works now.

Thanks very much,

Neda.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell: command not found / Runs fine with "Run command" badbunny Linux - Newbie 1 01-22-2007 01:21 AM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
bash: <command name> command not found smash Programming 5 03-13-2006 08:48 AM
command not found bin_shell Linux - General 3 02-15-2004 10:50 PM
Command not found HwzrHlslndr Linux - General 14 12-31-2002 07:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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