[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
redirection to achieve "egrep -q"
From: |
John Reiser |
Subject: |
redirection to achieve "egrep -q" |
Date: |
Sun, 01 Jul 2001 11:44:54 -0700 |
ltmain.sh (GNU libtool) 1.4 (1.920 2001/04/24 23:26:18)
In ltmain.sh or ltmain.in, the redirection in these 7 cases
(search for `sed.*egrep'):
if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null
2>&1; then :
if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null
2>&1; then :
if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null
2>&1; then
if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null
2>&1; then :
if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null
2>&1; then
if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null
2>&1; then
(sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null
2>&1; then
should be moved to inside the parentheses for the subshell:
if (sed -e '2q' "$lib" | egrep "^# Generated by .*$PACKAGE" >/dev/null
2>&1); then :
so that when run under "set -x", then the shell's announcement of the
running of sed and egrep does not get sent to /dev/null, but the
output from egrep still does go to /dev/null. In general, redirection
should be applied to the smallest scope that achieves the desired result.
And the explicit parentheses for the subshell are not necessary, either,
although they do provide some visual clarity.
Also note that the last argument to sed should be quoted: "$file"
to protect against shell metacharacters, as per my message of
06/12/01 to bug-libtool.
--
John Reiser, address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- redirection to achieve "egrep -q",
John Reiser <=