LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 06: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, 07:26 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 10: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, 10:34 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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

Just as if you were in a shell.


Cheers,
Tink
 
Old 10-28-2004, 11:11 PM   #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, 05:02 AM   #6
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
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, 06:26 PM   #7
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
Thanks...
 
  


Reply

Tags
write



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 08:58 AM
Create a text file using Bash Boffy Programming 5 03-14-2005 09:06 PM
Change Text-File through bash script arkus Programming 2 12-17-2004 08:48 PM
Need help reading text file in bash script scilec Programming 3 11-25-2004 06:44 PM
Send emails to list in text file using RedHat9 MrEase Linux - Newbie 1 04-24-2004 07:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:58 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration