Home » Infrastructure » Unix » Read value to a variable in shell script
Read value to a variable in shell script [message #98583] Mon, 17 January 2005 10:17 Go to next message
Pinki
Messages: 5
Registered: September 2004
Junior Member
There is a date value stored in a file temp.txt and the value is 20041115
I was wondering how to read this value to a variable in a shell script?
Let's say the variable olddate in shell script test.sh should be
olddate = 20041115
This olddate variable should read this value from temp.txt
Re: Read value to a variable in shell script [message #98584 is a reply to message #98583] Mon, 17 January 2005 16:38 Go to previous message
Jai Vrat
Messages: 20
Registered: June 2004
Junior Member
OLDDATE=`cat temp.txt 2>/dev/null`
Previous Topic: Unix-vs-Linux
Next Topic: Question on space usage >>
Goto Forum:
  


Current Time: Sat Jan 23 09:16:04 CST 2021