Unknown alias in ksh script problem.

Conor P. Cahill cpcahil at virtech.uucp
Fri Oct 27 04:38:05 AEST 1989


In article <7010003 at hpfcso.HP.COM>, pld at 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     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.questions mailing list