DE WEERD, Mario writes:
 > I have created a method that allows me to transfer files under a
 > compressed format.
 > Unfortunately the '~'-expansion does not work when calling these
 > commands and I am obliged to change the '/bin/sh' in the 'rcp.el' file
 > by '/bin/ksh'.
 > Then it works.
 > 
 > I need to use the '~' since my homedirectory is not the same on both
 > machines.
 > 
 > Any ideas (debug buffer and method below).

'~' is not supported in a vanilla Bourne shell but '$HOME' should
work.  Furthermore you should be logged into your home directory, so
omitting it altogether should work.

    ~/bin/myprog       Works in Korn, Posix, bash, etc. but not Bourne
    $HOME/bin/myprog   Works in all shells
    bin/myprog         Also works in all shells

This assumes that HOME exists.  The first two give meaningful errors
if it doesn't, the third may silently find /bin/myprog.  But if HOME
is not there we are just talking about how deep we are getting into
the proverbial.

Things are a bit trickier for '~joeuser'.  The alternatives are now

   ~joeuser/bin/myprog           Does not work in Bourne
   $HOME/../joeuser/bin/myprog   Might work in all shells
   ../joeuser/bin/myprog         Might work in all shells

These assume that all home directories are in the same place and named
after their owner.  If you really want to be robust, try something
like this.

    JOEUSER=`ypcat passwd | awk -F: '$1 == "joeuser" {print $6}'`

or

    JOEUSER=`awk -F: '$1 == "joeuser" {print $6}' /etc/passwd`

then

    $JOEUSER/bin/myprog

-- 
Pete Forman
Western Geophysical
[EMAIL PROTECTED]

Reply via email to