Results 1 to 5 of 5
Hi,
I try to write script and echo two command at the same line .
echo "A"
echo "B"
How can I pipe above two command at the same line ...
- 01-25-2011 #1Just Joined!
- Join Date
- Aug 2009
- Posts
- 44
echo two command output in the same line
Hi,
I try to write script and echo two command at the same line .
echo "A"
echo "B"
How can I pipe above two command at the same line in text file .
So, in the output text file , you can see below ???
notCode:A B
Any sugggestion ???Code:A B
- 01-25-2011 #2Does that help ?$echo "a" ; echo "b"
a
b
$ echo -n "a" ; echo "b"
ab- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 01-25-2011 #3Just Joined!
- Join Date
- Aug 2009
- Posts
- 44
- 01-25-2011 #4Just Joined!
- Join Date
- Dec 2010
- Posts
- 16
I am not sure whether I understand your question correct. Do you really want to have the output of ps twice and in one long line?
Then do:
If you want to have the output of ps only once, remove | tee -Code:ps -o %cpu,%mem,lstart,args,comm,cputime,pid,rss,vsz -p 1 | tee - | tr -d '\n' > output_ps
Last edited by Lahntaler; 01-25-2011 at 11:09 AM.
- 01-25-2011 #5Just Joined!
- Join Date
- Dec 2010
- Posts
- 16
If you want to have the output of ps both on stdout and a file, do:
tee with the option -a appends to output_ps.Code:ps -o %cpu,%mem,lstart,args,comm,cputime,pid,rss,vsz -p 1 | tee -a output_ps
tee overwrites output_ps if the option -a is not used.


Reply With Quote
