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!

appending variables in a shell script to a file

Status
Not open for further replies.

keto

Technical User
Aug 10, 2001
3
AU
I'm relatively new to shell scrpting and I want to know how you can read from the stdin interactively from a script and then append that variable to an existing file. Please can anyone help?
 
#!/bin/ksh

read a # get a line of something from stdin
print $a >> a_file.txt # append that to a file
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Hi keto,
If it is csh script then
set TAPENO = $<
echo &quot;$TAPENO&quot; >> test.txt

Patel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top