From: douglas@cs.scarolina.edu (David Douglas)
Newsgroups: comp.graphics.gnuplot
Subject: Re: Comment on GnuPlot V3.2 (under Unix)
Date: 12 Nov 92 17:44:41 GMT
Organization: USC  Department of Computer Science

rvenable@helix.nih.gov (Richard M. Venable) writes:

>In article <921105105653.1747@CUCCFA.CCC.COLUMBIA.EDU>,
>MARK@CUCCFA.CCC.COLUMBIA.EDU (T. Mark Reboul) writes:
>|> I have however noted just one minor thing which seems to me like a 
>|> deficiency.... I don't know how easy this would be to change, but it
>|> would be useful if the user could enter a "cd" command of the form:
>|> 
>|> 	cd  "~username/whatever"
>|> 
>|> The tilde spec doesn't seem to be allowed. (Am I doing something
>wrong?)

>The tilde is a construct of the C shell (/bin/csh), and is not
>recognized
>by system calls requiring a pathname.  In some of our programs here at
>NIH
>we substitute the value of the env var HOME for the tilde, which would
>permit   cd "~/whatever"  but not the above syntax.

>|> I also noticed that even this command:
>|> 
>|> 	!  cd  ~username
>|> 
>|> doesn't work, as the "system" function call generated by my command 
>|> won't handle the tilde.

>The above should work if /bin/csh is your login shell; however, the !
>operation spawns a new subshell, so that even if you do change
>directories,
>as soon as the subshell exits, you're back in the directory you were in
>before.


><---------------------------------------------------------------------->
>>
><  Rick Venable                (O O) |  "Back off, I'm a scientist."  
>>
><  FDA/CBER Biophysics Lab      )|(  |        -- Bill Murray in       
>>
><  rvenable@helix.nih.gov       (=)  |           'Ghostbusters'       
>>
><---------------------------------------------------------------------->
>>

One note I'd like to make here (I think I said it before, but anyway...)
The  system  command, at least from what I see in the manual page on it
here, ONLY accesses the /bin/sh shell, not /bin/csh.  From the man page
here for the  system  command:

  If the string argument is the NULL pointer (0) the system function tests
  the accessibility of the command interpreter sh(1).  The function will
  return zero for failure to find the command interpreter, and positive if
  successful.

  If the string argument is non-NULL the system routine causes the string
  to be given to sh(1) as input as if the string had been typed as a com-
  mand at a terminal.  The current process waits until the shell has com-
  pleted, then returns the exit status in the form that wait(2) returns.


So, in otherwords, if you want to use a shell with the "!" command,
and use the "~" to access a particular user's directory, try something
like the following:

! csh -c 'cd ~username/directoryname ; next command ; next command ; (etc.)'

where all your shell commands (separated by semicolons) are enclosed in the
''s immediately following the  -c  option given to csh.

Hope this helps!

David Douglas
x-gateway: rodan.UU.NET from info-gnuplot to comp.graphics.gnuplot; Wed, 11 Nov 1992 12:44:22 EST
X400-Received: by mta chx400.switch.ch in /PRMD=switch/ADMD=arcom/C=CH/;
               Relayed; Wed, 11 Nov 1992 18:11:17 +0100
Date: Wed, 11 Nov 1992 18:05:17 +0100
X400-Originator: grossgla@di.epfl.ch
X400-Recipients: info-gnuplot@ames.arc.nasa.gov
X400-Mts-Identifier: [/PRMD=SWITCH/ADMD=ARCOM/C=CH/;9211111705.AA16192]
X400-Content-Type: P2-1984 (2)
From: "(Matthias Grossglauser)" <grossgla@di.epfl.ch>
Subject: gnuplot_note
Newsgroups: comp.graphics.gnuplot