LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 07-17-2007, 08:52 AM   #1
Filipe
LQ Newbie
 
Registered: Dec 2005
Posts: 23

Rep: Reputation: 15
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
 
Old 07-17-2007, 09:05 AM   #2
wimdh
LQ Newbie
 
Registered: Aug 2004
Location: Dendermonde, Belgium
Distribution: Ubuntu latest
Posts: 28

Rep: Reputation: 15
This might work:

TXT=`cat file.txt`
echo $TXT


Cheers!
 
Old 07-17-2007, 09:07 AM   #3
radoulov
Member
 
Registered: Apr 2007
Location: Milano, Italia/Варна, България
Distribution: Ubuntu, Open SUSE
Posts: 212

Rep: Reputation: 35
Code:
TXT="$(<file.txt)"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help regarding my very simple bash script hottdogg Programming 3 05-02-2007 02:09 AM
Simple bash script help zok Linux - General 4 12-15-2006 11:56 AM
Simple Bash Script Help njdownes Programming 2 03-05-2005 07:35 AM
Help with simple bash script - please tw001_tw Linux - Software 5 12-19-2004 09:02 PM
Simple BASH script fio Linux - General 5 01-18-2003 03:26 PM


All times are GMT -5. The time now is 11:10 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration