FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-13-2008, 04:44 PM
"Stefan Schmidt"
 
Default Bash: trap vs. tee

> Closing quotes are missing, but your script hopefully has them.

Yes, indeed

> Because the exit status of the pipe is that of the last command, and tee
> has no reason to complain:

I was suspecting something like that, but unfortunately I had misinterpreted the output of my debugging variations.

> In bash you can change this behavior with "set -o pipefail".

Thanks a lot, that works like a treat!

Stefan


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-13-2008, 08:20 PM
Sven Joachim
 
Default Bash: trap vs. tee

On 2008-07-13 18:44 +0200, Stefan Schmidt wrote:

>> In bash you can change this behavior with "set -o pipefail".
>
> Thanks a lot, that works like a treat!

One caveat, however: this option was introduced in bash 3, so it will
not work with older versions. And of course you need to make sure that
your script starts with #!/bin/bash and not #!/bin/sh.

To the shell gurus on this list: what can be done in other shells that
do not support this nice feature? Is it necessary to refrain from using
the pipe at all if the exit code of the first command in it matters?

Sven


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 04:02 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org