[comp.unix.aix] bug in nohup?

ghe@physics.orst.edu (Guangliang He) (06/05/91)

This is on a RS/6000 530 with AIX3.1 3002. I have a 5 line shell script named
haha:
------------
$ cat haha
echo $SHELL
echo $HOME
cd /tmp
cd ~
ls -CF
------------
$ ll haha
-rwxr-xr-x   1 ghe      staff         43 Jun 04 10:13 haha
------------

My login shell is /bin/ksh. If I run 'haha' directly, everything is normal.
But I have problem run haha with 'nohup' command. The nohup.out gives right
answer for $SHELL, and $HOME but it says:

~: No such file or directory

then went ahead listed the files in /tmp. 

What is the problem?

By the way, the script works fine if I put a #!/bin/ksh at the very beginning.

---
  Guangliang He
  ghe@physics.orst.edu

pfink@watson.ibm.com (Paul Fink) (06/05/91)

In article <1991Jun04.172858.4736@lynx.CS.ORST.EDU>, ghe@physics.orst.edu (Guangliang He) writes:
|> 
|> This is on a RS/6000 530 with AIX3.1 3002. I have a 5 line shell script named
|> haha:
|> ------------
|> $ cat haha
|> echo $SHELL
|> echo $HOME
|> cd /tmp
|> cd ~
|> ls -CF
|> ------------

Hi  Guangliang,
  I think you have hit a feature in AIX that almost requires that every
shell script start with "#!/bin/<shell>". In your case nohup is running the
command with /bin/bsh which don't know nothin' about ~.
  But in general is much safer in AIX to declare what shell you want your
script to run under. You will find this especially true if you use csh and
write ksh scripts.

Paul Fink

lynnand@wombat.austin.ibm.com (M. Lynn Anderson) (06/06/91)

> My login shell is /bin/ksh. If I run 'haha' directly, everything is normal.
> But I have problem run haha with 'nohup' command. The nohup.out gives right
> answer for $SHELL, and $HOME but it says:
> 
> ~: No such file or directory
> 
> then went ahead listed the files in /tmp. 
> 
> What is the problem?
> 
> By the way, the script works fine if I put a #!/bin/ksh at the very
beginning.
> 
> ---
>   Guangliang He
>   ghe@physics.orst.edu

The default shell script execution is /bin/sh.
This is a link to /bin/bsh becuase there are so many scripts 
out there that assume /bin/sh is the bourne shell.
The best answer is to include #!/bin/ksh in your script.

M. Lynn Anderson 

lynnand@wombat.austin.ibm.com 

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~  The level of decline in a society can be extrapolated as  ~ 
  ~  a direct inverse of the instance of common courtesy.      ~
  ~  ie. any engine will break down if it isn't lubricated.    ~
  ~                                                            ~
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DISCLAIMER: This posting is independent of official IBM position.

wangh@beasley.CS.ORST.EDU (Haiyan Wang) (06/06/91)

In article <8219@awdprime.UUCP> lynnand@wombat.austin.ibm.com writes:
>
>The default shell script execution is /bin/sh.

I thought that the default shell on AIX 3 is /bin/ksh. 

Guangliang He
ghe@physics.orst.edu

jsalter@ibmpa.awdpa.ibm.com (06/07/91)

In article <1991Jun06.050104.7243@lynx.CS.ORST.EDU> wangh@beasley.CS.ORST.EDU (Haiyan Wang) writes:
>In article <8219@awdprime.UUCP> lynnand@wombat.austin.ibm.com writes:
>>The default shell script execution is /bin/sh.
>I thought that the default shell on AIX 3 is /bin/ksh. 

Thank goodness, no.  We headed that problem off at the pass.  The default
login shell is (I think).  /bin/sh, though, links to /bin/bsh which is
the Bourne shell.

>Guangliang He
>ghe@physics.orst.edu

jim/jsalter  IBM PSP, Palo Alto  T465/(415)855-4427  VNET: JSALTER at AUSVMQ
Internet: jsalter@slo.awdpa.ibm.com         UUCP: ..!uunet!ibmsupt!jsalter 
"IBM part #23521, aka Lt. Commander Data"    The stuff above is on my own.

wangh@beasley.CS.ORST.EDU (Haiyan Wang) (06/07/91)

In article <1991Jun7.053620.9090@ibmpa.awdpa.ibm.com> jsalter@slo.awdpa.ibm.com (Jim Salter) writes:
>
>Thank goodness, no.  We headed that problem off at the pass.  The default
>login shell is (I think).  /bin/sh, though, links to /bin/bsh which is
>the Bourne shell.
>

At least smit use /bin/ksh as the default login shell.
                  ^^^^^^^^

>jim/jsalter  IBM PSP, Palo Alto  T465/(415)855-4427  VNET: JSALTER at AUSVMQ
>Internet: jsalter@slo.awdpa.ibm.com         UUCP: ..!uunet!ibmsupt!jsalter 
>"IBM part #23521, aka Lt. Commander Data"    The stuff above is on my own.

Guangliang He
ghe@physics.orst.edu