root@mccc.uucp (Pete Holsberg) (12/13/89)
A user on CompuServe asks if there is a way to define a Korn shell alias with positional parameters, a la a script. He says that every time he tries a definition, the actual parameter is ignored. Pete -- Prof. Peter J. Holsberg UUCP: {...!rutgers!}princeton!mccc!pjh Engrg. Technology Voice: 1-609-586-4800 Mercer College CompuServe: 70240,334 1200 Old Trenton Road GEnie: PJHOLSBERG
tneff@bfmny0.UU.NET (Tom Neff) (12/14/89)
In article <1989Dec12.182809.5507@mccc.uucp> root@mccc.uucp (Pete Holsberg) writes: >A user on CompuServe asks if there is a way to define a Korn shell alias >with positional parameters, a la a script. He says that every time he >tries a definition, the actual parameter is ignored. Korn shell aliases do not use positional parameters. If you include one in an alias definition, the corresponding positional parameter from the current environment, script or interactive environment will be substituted. (Aliases are always treated as if you had simply typed the expansion string yourself instead of typing the alias.) For a programmable abbreviation that executes fast and in the current environment, use Korn shell functions instead. They support positional parameters. -- "We plan absentee ownership. I'll stick to `o' Tom Neff building ships." -- George Steinbrenner, 1973 o"o tneff@bfmny0.UU.NET
mbrown@dec3.osf.org (Mark Brown) (12/14/89)
In article <1989Dec12.182809.5507@mccc.uucp> root@mccc.uucp (Pete Holsberg) writes: >A user on CompuServe asks if there is a way to define a Korn shell alias >with positional parameters, a la a script. He says that every time he >tries a definition, the actual parameter is ignored. Try writing a ksh "function"; these are provided to do exactly what this guy seems to be asking for... Mark Brown IBM AWD / OSF | The hardest thing in the world to understand, The Good mbrown@osf.org | is income tax. The Bad uunet!osf!mbrown| ---Albert Einstein The Ugly (617) 621-8981 |
jimr@hp-lsd.COS.HP.COM (Jim Rogers) (12/15/89)
You cannot pass positional parameters to a KSH alias. What you want is a KSH function. If you export the function then it can be made available to sub-shells. Jim Rogers