IDL and BASH scripts [message #68227] |
Thu, 08 October 2009 13:49  |
natha
Messages: 482 Registered: October 2007
|
Senior Member |
|
|
Hi guys,
I wrote a script to help me with the most common actions I always do
in IDL. I copy some folders, I update some files and finally I call
IDL to do some actions.
Normally I use something like this:
idl <<!here
some_actions
@my_program.pro
resolve_all
save, filename='my_program.sav', /routines
exit
!here
It works good but I've a problem if I try to run this code inside a
case statement. My idea is to execute this code as an optional
argument for my script. When I try to do it I've an error:
here-document at line 127 delimited by end-of-file (wanted `!here')
unexpected end of file
I don't understand the error and I don't know if there are more
options to call IDL and do some actions from a BASH script. Can
anybody help ? Thanks,
nata
|
|
|
Re: IDL and BASH scripts [message #68294 is a reply to message #68227] |
Wed, 14 October 2009 07:05  |
natha
Messages: 482 Registered: October 2007
|
Senior Member |
|
|
Hi Paul and PP,
"Are you indenting in the case statement? If so, the "!here" won't be
recognised if there
is whitespace in front of it." <- lol !
I didn't know all of that. Thanks for your reply guys.
I replaced !here for -here and all works good !
The use of these marks is a little bit confusing and actually I never
find documentation for it.
Thanks !
Regards,
nata
|
|
|
Re: IDL and BASH scripts [message #68300 is a reply to message #68227] |
Tue, 13 October 2009 07:36  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
nata wrote:
> Hi guys,
>
> I wrote a script to help me with the most common actions I always do
> in IDL. I copy some folders, I update some files and finally I call
> IDL to do some actions.
> Normally I use something like this:
>
> idl <<!here
> some_actions
> @my_program.pro
> resolve_all
> save, filename='my_program.sav', /routines
> exit
> !here
>
> It works good but I've a problem if I try to run this code inside a
> case statement. My idea is to execute this code as an optional
> argument for my script. When I try to do it I've an error:
> here-document at line 127 delimited by end-of-file (wanted `!here')
> unexpected end of file
>
> I don't understand the error and I don't know if there are more
> options to call IDL and do some actions from a BASH script. Can
> anybody help ? Thanks,
Are you indenting in the case statement? If so, the "!here" won't be recognised if there
is whitespace in front of it.
If that is the case (no pun intended), in your script if you do something like
idl <<-NoMoreInput
some_actions
@my_program.pro
resolve_all
save, filename='my_program.sav', /routines
exit
NoMoreInput
i.e. put the "-" between the "<<" and end-of-file marker, you can tab in.
I also agree with pp on the use of "!here" as an eof marker - apart from any issue with
the ! character, it doesn't really explain what it does. But, that's just my personal
preference (I tend to be verbose in code :o).
Anyway, HTH.
cheers,
paulv
|
|
|
Re: IDL and BASH scripts [message #68317 is a reply to message #68227] |
Fri, 09 October 2009 11:42  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Oct 8, 5:49 pm, nata <bernat.puigdomen...@gmail.com> wrote:
> Hi guys,
>
> I wrote a script to help me with the most common actions I always do
> in IDL. I copy some folders, I update some files and finally I call
> IDL to do some actions.
> Normally I use something like this:
>
> idl <<!here
> some_actions
> @my_program.pro
> resolve_all
> save, filename='my_program.sav', /routines
> exit
> !here
>
> It works good but I've a problem if I try to run this code inside a
> case statement. My idea is to execute this code as an optional
> argument for my script. When I try to do it I've an error:
> here-document at line 127 delimited by end-of-file (wanted `!here')
> unexpected end of file
>
> I don't understand the error and I don't know if there are more
> options to call IDL and do some actions from a BASH script. Can
> anybody help ? Thanks,
> nata
It looks like the end of the here document is not getting recognized,
so it is complaining that it ran to the end of the file without ending
the here document. My first guess is that the problem may come from
the limiter starting with !, which makes it look like 'here' preceded
by the ! operator. You can try replacing the delimiter with some odd
sequence of characters that does not include any possibly-special
characters.
|
|
|