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

reading file into kornshell

Status
Not open for further replies.

TracyPyne

Technical User
Apr 25, 2002
1
GB
Hi,

in shell script you can use
var=`cat text.txt`
to set var to contain the value of the text file (which in this case is a single word).

How do you do this in Korn shell?

Thanks

Tracy
 
backticks works in ksh and the posix shell, (also called sh, just to confuse you)

a ksh specific way of doing that would be

var=$(cat text.txt)

this is nice because it nests so easily, like this

file=$(basename $(whence cat)) Mike
______________________________________________________________________
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top