You are not logged in.
I'm having a little problem.
I have textfile with a single line of text. What I want to do is set a variable with that line of text. How do I go about doing that?
A simple var="text" wont work in this case, since the text in the file changes with another script of mine.
Thanks in advance.
Last edited by Aziere (2007-03-27 09:07:03)
Offline
var="`cat file`"
Offline
Or var=$( cat file ), if you like.
Offline
if you have a file with more than one line but you only want the first line you could use 'head'
VAR=`head -n 1 file`
Last edited by SiD (2007-03-27 05:58:33)
Offline