LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 10-28-2004, 07:33 PM   #1
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Rep: Reputation: 30
Question send text to file bash


I was wondering how to send text from a bash script to a file.
I know I have to use the < "FILE" command, but I don't know how to tell it what text to put in the file.

anyone know how?
 
Old 10-28-2004, 08:26 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,999
Blog Entries: 11

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
What are you trying to achieve, write to a file
from a script, or redirect a file into a script?

< is an input-redirector.


Cheers,
Tink
 
Old 10-28-2004, 11:29 PM   #3
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
Sorry for the confusion (lack of info), but I'm trying to write to a file
from a script.
The text that will be entered into the file will be contained in the script.
I just don't know how to make the script write the contained text to the file.
 
Old 10-28-2004, 11:34 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,999
Blog Entries: 11

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
echo $TEXT > my_file

Just as if you were in a shell.


Cheers,
Tink
 
Old 10-29-2004, 12:11 AM   #5
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
THANKS ALOT!!!!
whatever an affero is, your getting one......
Thanks again...
 
Old 10-29-2004, 06:02 AM   #6
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 46
1>filename
# Redirect stdout to file "filename".

1>>filename
# Redirect and append stdout to file "filename".

2>filename
# Redirect stderr to file "filename".

2>>filename
# Redirect and append stderr to file "filename".

&>filename
# Redirect both stdout and stderr to file "filename".
 
Old 11-01-2004, 07:26 PM   #7
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
Thanks...
 
  


Reply

Tags
write


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash: split text file iluvatar Programming 4 08-22-2005 09:58 AM
Create a text file using Bash Boffy Programming 5 03-14-2005 10:06 PM
Change Text-File through bash script arkus Programming 2 12-17-2004 09:48 PM
Need help reading text file in bash script scilec Programming 3 11-25-2004 07:44 PM
Send emails to list in text file using RedHat9 MrEase Linux - Newbie 1 04-24-2004 08:35 PM


All times are GMT -5. The time now is 05:59 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