LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Simple Bash Script (https://www.linuxquestions.org/questions/linux-newbie-8/simple-bash-script-570080/)

Filipe 07-17-2007 08:52 AM

Simple Bash Script
 
I need to put the contents of a file
file.txt in a bash variable...

something like
"cat file.txt>$TXT"
(this doesn´t work)


can you help me ?
Tanks

wimdh 07-17-2007 09:05 AM

This might work:

TXT=`cat file.txt`
echo $TXT


Cheers!

radoulov 07-17-2007 09:07 AM

Code:

TXT="$(<file.txt)"


All times are GMT -5. The time now is 05:37 PM.