[Thread Prev][Thread Next][Index]

Re: spawn output to ferret variable/symbol

On Fri, 25 Jan 2002, Pal Jeremy wrote:
> I would like to make the current working directory a label on my
> plot.  Is there some way to have spawn output ('spawn pwd' in my
> case) become the value of a variable or symbol?

Hi Pal,

The most robust way I've found to do this is by creating a .jnl file,
running it, and deleting it:

sp echo def sym dir \"\`pwd\`\" > pwd_output.tmp.jnl
go pwd_output.tmp.jnl
sp rm pwd_output.tmp.jnl
say "($dir)"

If you are using Ferret v5.3 or higher, you can try 
   yes? let a = {system:"pwd"}
   yes? list a 
but this doesn't seem robust quite yet -- in Linux it fails in v5.4beta1
and sometimes segmentation faults in v5.33beta, i.e. after
   yes? let a = {system:"ls"}

Hope that helps!


Andrew Wittenberg          Program in Atmospheric and Oceanic Sciences
andyw@splash.princeton.edu                        Princeton University

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement