[Thread Prev][Thread Next][Index]
Re: [ferret_users] create go files on the fly
David,
| I have a script in which a chunk of code is used several times, so I
| copied and pasted it into several different places. Then I thought,
| well, maybe I can shorten my script by wrapping that chuck of code
| in an additional go file, and if possible, on the fly. So I tried
| the following,
|
| sp cat << EOF > tmp.jnl
|
| my code here
|
| EOF
|
| go tmp.jnl
| ...
| go tmp.jnl
| ...
| ...
| sp rm -f tmp.jnl
|
| But it doesn't work. The lines in between two EOF didn't find
| themselves in the file tmp.jnl. Has anyone done similar tricks
| before? I really like the idea of creating files on the fly...
I think it's much more flexible to use a shell script as your
"main" program, like so:
#!/bin/sh
cat <<EOF > tmp.jnl
your code here
EOF
cat <<EOF > tmp2.jnl
go tmp.jnl
...
go tmp.jnl
...
...
EOF
ferret -script tmp2.jnl
rm tmp.jnl tmp2.jnl
Your original style doesn't work because "SP" invokes a shell
and exits before the next line of your Ferret script starts.
Cheers,
Ryo
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Privacy Policy | Disclaimer | Accessibility Statement