You are not logged in.

#1 2005-06-13 08:15:07

sweiss
Member
Registered: 2004-02-16
Posts: 635

A little BASH question (I think)

Hey there.
I'm working on some pacman script, and for that I use the following command:
`echo n | pacman -Suy >text.out`

text.out includes the data I want to have in the file. but pacman still spitts some output to the screen, which I'd like to hide.

Can you please tell me how to do so?

Thanks in advance.

Offline

#2 2005-06-13 08:20:01

mico
Member
From: Slovenia
Registered: 2004-02-08
Posts: 239

Re: A little BASH question (I think)

There are 2 out streams that are usually put on console:
stdout (standard output, number 1 = default)
stderr (standard error, number 2)

You can redirect them like this:
>stdout.txt 2>stderr.txt

or both to same file like this:
&>both.txt

Offline

#3 2005-06-13 08:20:10

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,615
Website

Re: A little BASH question (I think)

If you want to redirect all output, then you need to handle stderr streams too.
redirecting output streams

EDIT: Aww. slow on the trigger. Oh well, teach a man to fish..


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#4 2005-06-13 08:32:16

T-Dawg
Forum Fellow
From: Wilmington, NC
Registered: 2005-01-29
Posts: 2,734

Re: A little BASH question (I think)

or 2>/dev/null will deep six the message all together....

Offline

#5 2005-06-13 08:37:50

sweiss
Member
Registered: 2004-02-16
Posts: 635

Re: A little BASH question (I think)

Thanks a lot for your replies.

Offline

#6 2005-06-13 09:28:59

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,431
Website

Re: A little BASH question (I think)

i always wondered about that too but never knew how to ask!

Offline

#7 2005-06-13 14:48:27

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: A little BASH question (I think)

dibblethewrecker wrote:

i always wondered about that too but never knew how to ask!


Here's a good way!!:


sweiss wrote:

Hey there.
I'm working on some pacman script, and for that I use the following command:
`echo n | pacman -Suy >text.out`

text.out includes the data I want to have in the file. but pacman still spitts some output to the screen, which I'd like to hide.

Can you please tell me how to do so?

Thanks in advance.

8)

Dusty

Offline

#8 2005-06-13 22:24:05

T-Dawg
Forum Fellow
From: Wilmington, NC
Registered: 2005-01-29
Posts: 2,734

Re: A little BASH question (I think)

smart a$$
lol  big_smile

Offline

#9 2005-06-14 02:10:16

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: A little BASH question (I think)

Sorry, I've been bored... when the mods (*ahem*) get around to cleaning up the off topic posts, my count is gonna plummet again.

Dusty

Offline

Board footer

Powered by FluxBB