[Thread Prev][Thread Next][Index]

Re: [ferret_users] ferret -script with history

Hi Patrick,
What ferret -script does is to use a simpler command-line reading method, as is used in -server mode.  It doesn't use the same readline calls that are used in other modes, and this means that the commands aren't available to echo back with the up-arrows.  I don't see a way to change that behavior.

A simple method, if not very elegant, might be to have the script just type itself out before exiting.  If myscript.jnl has in it:
  say "We are in 2009"
  sp cat myscript.jnl
Then if it is executed either by piping it into Ferret with
> ferret < myscript.jnl
or with
> ferret -script myscript.jnl
then the commands would at least be available to the user.


Brockmann Patrick wrote:
Ryo Furue a écrit :

| I am wondering how to launch ferret with a pre-existing script and get
| a prompt AND history ready to use ?
| | If myscript.jnl is the simple script bellow:
| say "We are in 2009"
| exit/prompt
| | Then if I type
| ferret -script myscript.jnl
| I launch ferret and run the script, get the prompt BUT no history | features (use of arrows up/down).
| | Any idea on how to get the load of a script at starting ?

Does this meet your needs?

  $ ferret
        FERRET v6.02
        Linux(g77) 2.4.21-32 - 04/30/07
        21-Jan-09 11:57

  yes? go myscript.jnl
  say "We are in 2009"
  We are in 2009
Probably you don't need "exit/prompt" in this case.
Yes you need this line to get the prompt back and be ready to use ferret with the loaded script.
Another idea is that you write a shell script like

  mv $rc $rc_bak
  cat $rc_bak "$1" > $rc
  ferret "$@"
  rm $rc
  mv $rc_bak $rc

call it, say, "ferret-init-with", and use it as

  $ ferret-init-with myscript.jnl . . . .
Seems not so easy to implement if I have heterogeneous platform users (Linux and Windows).

What about this feature for next release...

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement