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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'echo' to perfrom 'ls' command

Status
Not open for further replies.

MagnumVP

IS-IT--Management
Jul 9, 2002
109
US
Is it possible to allow the echo command to perform a 'ls' command in the KORN shell?

I've tried;
>list='ls'
>echo $list
>ls

AND

>list="ls"
echo $list
ls

Any thoughts?

MagnumVP
 
Hi MagnumVP,

in the Korn Shell the follwing is possible:

$ echo *
will give you a list of all files in your working directory.

If you want to store that list in a variable then you have to use back quotes:

$ list=`ls`
$ echo $list
will give you exactly the same output as the echo command.

mrjazz [pc2]
 
list=`ls`
echo list

would work ... but the actual work isw done at the list=`ls` stage.

note these are backquotes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top