[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-grep] egrep and fgrep script assume path
From: |
Paul Jarc |
Subject: |
Re: [bug-grep] egrep and fgrep script assume path |
Date: |
Thu, 27 Jan 2005 09:55:26 -0500 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
Stepan Kasal <address@hidden> wrote:
> */*) dir=${0%/*}/ 2>/dev/null
This doesn't suppress the error message. It seems that to suppress
it, you must put the expansion inside a compound command, and apply
the redirection to that compound command. That works because Solaris
sh spawns a subshell for a compound command with redirections, and the
error message would come from the child shell, whose stderr has been
redirected by the parent.
There might be other shells that fork in this case, but do support
advanced expansion, so this also means that the probe has to be done
separately from the actual use of the expansion:
if { dir=${0%/*} } 2> /dev/null; then
dir=${0%/*}/
else
dir=`dirname "$0"`
fi
paul
- [bug-grep] egrep and fgrep script assume path, Joe Weening, 2005/01/26
- Re: [bug-grep] egrep and fgrep script assume path, Paul Jarc, 2005/01/27
- Re: [bug-grep] egrep and fgrep script assume path, Stepan Kasal, 2005/01/26
- Re: [bug-grep] egrep and fgrep script assume path, Paul Jarc, 2005/01/27
- Re: [bug-grep] egrep and fgrep script assume path, Stepan Kasal, 2005/01/27
- Re: [bug-grep] egrep and fgrep script assume path,
Paul Jarc <=
- Re: [bug-grep] egrep and fgrep script assume path, Stepan Kasal, 2005/01/27
- Re: [bug-grep] egrep and fgrep script assume path, Paul Jarc, 2005/01/27
- Re: [bug-grep] egrep and fgrep script assume path, Stepan Kasal, 2005/01/27
- Re: [bug-grep] egrep and fgrep script assume path, Paul Eggert, 2005/01/27
- Re: [bug-grep] egrep and fgrep script assume path, Stepan Kasal, 2005/01/28
- Re: [bug-grep] egrep and fgrep script assume path, Paul Eggert, 2005/01/29
- Re: [bug-grep] egrep and fgrep script assume path, Stepan Kasal, 2005/01/29
- Re: [bug-grep] egrep and fgrep script assume path, Paul Eggert, 2005/01/31