I have an AMAHI server (amahi.org) that runs on FC10.
I am trying to execute a simple script that includes:
function correct { echo echo 'Is this correct (1=Yes,0=No): ' read answer } correct
But this fails with:
./test1 '/test1: line 1: syntax error near unexpected token `{ '/test1: line 1: `function correct {
But this little snippit runs fine on my notebook, ergo I am missing some important little rpm. I would like to add as little as needed, as this is suppose to be a production system, but then again simple script elements like this SHOULD work.
Or is it an environment problem?
On 09/23/2009 01:35 PM, Robert Moskowitz wrote:
'/test1: line 1: syntax error near unexpected token `{
Starting the script with
#!/bin/bash
might be a good idea.
Mogens
Mogens Kjaer wrote:
On 09/23/2009 01:35 PM, Robert Moskowitz wrote:
'/test1: line 1: syntax error near unexpected token `{
Starting the script with
#!/bin/bash
might be a good idea.
I used vi to insert this line and I get:
./test1 -bash: ./test1: /bin/bash^M: bad interpreter: No such file or directory
I don't see that control M in vi or gedit...
On 09/23/2009 02:02 PM, Robert Moskowitz wrote:
^M
The file is in dos format, with crlf line termination.
Open the file in vi and do:
:set ff=unix
and save the file again.
Mogens
Robert Moskowitz wrote:
Mogens Kjaer wrote:
On 09/23/2009 01:35 PM, Robert Moskowitz wrote:
'/test1: line 1: syntax error near unexpected token `{
Starting the script with
#!/bin/bash
might be a good idea.
I used vi to insert this line and I get:
./test1 -bash: ./test1: /bin/bash^M: bad interpreter: No such file or directory
I don't see that control M in vi or gedit...
vi -b test1
Mogens Kjaer wrote:
On 09/23/2009 02:02 PM, Robert Moskowitz wrote:
^M
The file is in dos format, with crlf line termination.
Open the file in vi and do:
:set ff=unix
and save the file again.
This file was created by pulling out part of a script that was failing by <ctl-c> in gedit and 'cat > test1' in a terminal window. And vi was run in a terminal window adding the bash line.
So it seems like there is an environment setup problem on this system, setting it up for DOS default rather than unix?
Now I could almost understand this, as the AMAHI server is designed as a SAMBA replacement for NT servers and the like... ???
On Wed, 2009-09-23 at 08:02 -0400, Robert Moskowitz wrote:
Mogens Kjaer wrote:
On 09/23/2009 01:35 PM, Robert Moskowitz wrote:
'/test1: line 1: syntax error near unexpected token `{
Starting the script with
#!/bin/bash
might be a good idea.
I used vi to insert this line and I get:
./test1 -bash: ./test1: /bin/bash^M: bad interpreter: No such file or directory
I don't see that control M in vi or gedit...
---- control characters are invisible unless the software has a provision to make invisible characters visible (something like OOo can do).
adding a (^M) Control-M to each line ending is something a Macintosh would normally do. When in doubt, you can always use 'od' command to tell you exactly what is in a file, byte by byte.
You can 'fix' the line endings in any file using 'dos2unix' command. Type 'dos2unix --help' to get the syntax.
Craig
On Wed, Sep 23, 2009 at 07:35:41AM -0400, Robert Moskowitz wrote:
I have an AMAHI server (amahi.org) that runs on FC10.
I am trying to execute a simple script that includes:
function correct { echo echo 'Is this correct (1=Yes,0=No): ' read answer } correct
But this fails with:
./test1 '/test1: line 1: syntax error near unexpected token `{ '/test1: line 1: `function correct {
But this little snippit runs fine on my notebook, ergo I am missing some important little rpm. I would like to add as little as needed, as this is suppose to be a production system, but then again simple script elements like this SHOULD work.
Or is it an environment problem?
The problem could be in parsing what comes before the 'function correct {' line. If you can, paste the script at fpaste.org, and then send a link to the list for further analysis.
Paul W. Frields wrote:
On Wed, Sep 23, 2009 at 07:35:41AM -0400, Robert Moskowitz wrote:
I have an AMAHI server (amahi.org) that runs on FC10.
I am trying to execute a simple script that includes:
function correct { echo echo 'Is this correct (1=Yes,0=No): ' read answer } correct
But this fails with:
./test1 '/test1: line 1: syntax error near unexpected token `{ '/test1: line 1: `function correct {
But this little snippit runs fine on my notebook, ergo I am missing some important little rpm. I would like to add as little as needed, as this is suppose to be a production system, but then again simple script elements like this SHOULD work.
Or is it an environment problem?
The problem could be in parsing what comes before the 'function correct {' line. If you can, paste the script at fpaste.org, and then send a link to the list for further analysis.
Turns out to be <ctl-M> s at the end of each line. Now I have to get the developer to figure out how he got these in the file and why it works on his system and not on mine....