Start a Conversation

Unsolved

This post is more than 5 years old

P

706

October 29th, 2008 06:00

problem with bash script on celerra control station

#!/bin/bash
#
get_fs_list ()
{
date
}
#
get_fs_list

gets

bash -v test.sh
#!/bin/bash
#
get_fs_list ()
'est.sh: line 3: syntax error near unexpected token `
'est.sh: line 3: `get_fs_list ()

What's wrong??

This works fine on Solaris 10.

2 Intern

 • 

20.4K Posts

October 29th, 2008 06:00

you are just calling a function ? Try this:

function get_fs_list {

date
}

get_fs_list

62 Posts

October 29th, 2008 07:00

thanks for the feedback!

62 Posts

October 29th, 2008 07:00

Turns out the orignal file for this script had some embedded control character in it that was causing the bash interpreter to choke. After lots of quick small tests I stumbled on the fact that this thing runs fine if I just cut and paste it into a different file. If I copy the original file and try to run it with a different name it gives me the same error. Problem solved.

2 Intern

 • 

20.4K Posts

October 29th, 2008 10:00

yeah ..if the file was created on Windows it probably has CRLF characters. You can run "dos2unix filename.sh" ..and that will take care of that.
No Events found!

Top