Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: Unknown alias in ksh script problem. Message-ID: <1989Oct26.183805.6894@virtech.uucp> Date: 26 Oct 89 18:38:05 GMT References: <7010003@hpfcso.HP.COM> Organization: Virtual Technologies Inc. Lines: 33 In article <7010003@hpfcso.HP.COM>, pld@hpfcso.HP.COM (Paul Dineen) writes: > $ alias bigfiles='sort -r +4' > $ cat >script > #!/bin/ksh > ll | bigfiles > ^D > $ script > ./script[2]: bigfiles: not found > > When the line "ll | bigfiles" is executed from the keyboard, there is > no problem. Wha' happen? The alias is not exported to the sub-shell. To get the correct effect you can run: . script Or you can put the alias into your $ENV file so that the alias is scanned during the shell startup. Or (much preferred) you can change the shell so that it doesn't use the alias. Aliases are designed to ease typing, but since this is going into a script, you don't need to ease the typing. Using the alias will make the shell harder to decipher and unusable for anyone that does not have your identical environment. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+