Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

commandline option

Status
Not open for further replies.

Tdlearner

Technical User
Jun 17, 2004
13
US
How come the following works just fine in korn shell on command line ?

listpage="ls | more" ; listpage


thanks,
 
THIS will work (korn shell alias):

alias listpage="ls | more" ; listpage


But only without the optional parameter for ls because

"listpage /tmp" is then alias-expanded to "ls | more /tmp"


If you want to use pipes and whatnot, better use a shell function

listpage()
{
ls $* | more
}

listpage then gets to "ls | more" inside the function
listpage /tmp gets to "ls /tmp | more"

and both will work.


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top