Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-06-2010, 05:00 PM   #1
LQ Newbie
Registered: Sep 2010
Posts: 12

Rep: Reputation: 0
echo to a file using bash

atm I have
echo exited var1 null >> debug.nfo
but what if I wanted to echo to 2 files i.e. one main debug file and one linked to the specific run of the script i.e. $1debug.nfo

do I have to write the line twice or can I echo the same information into 2 files using just 1 line and 1 echo command?
Old 11-06-2010, 05:03 PM   #2
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
look up the `tee` command. It will allow you to tee the data to two or more files, as well as to stdout.
Old 11-07-2010, 05:37 AM   #3
LQ Newbie
Registered: Sep 2010
Posts: 12

Original Poster
Rep: Reputation: 0
ok thanks


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash echo variables casperdaghost Linux - Newbie 9 03-10-2010 04:21 PM
BASH: instad of echo-ing, I just want to assing to a bash variable... how?? rylan76 Linux - Newbie 9 11-28-2008 08:46 AM
Bash shell file... echo on? carlos_vcan Linux - Newbie 3 06-12-2008 10:10 PM
(bash) echo "#!/bin/bash" event not found - trying to generate profiles automatically jimieee Programming 9 05-03-2006 10:24 AM
Turning echo off in bash slomek Programming 1 03-01-2006 11:38 AM

All times are GMT -5. The time now is 10:17 PM.

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