bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Commands executed with $($prog) do not run properly


From: Hans-Georg Bork
Subject: Commands executed with $($prog) do not run properly
Date: Sat, 06 Nov 2010 03:09:08 +0100

From: Hans-Georg Bork <hgb@hgbhome.net>
To: bug-bash@gnu.org, bash@packages.debian.org
Subject: Commands ran with $($prog) do not run properly

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR
='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.
-I../bash -I../bash/include -I../bash/lib   -g -O2 -Wall
uname output: Linux linprofs-hgb 2.6.32-5-amd64 #1 SMP Wed Oct 20
00:05:22 UTC 2010 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.1
Patch Level: 5
Release Status: release

Description:

Hi,

if a program ist started with $($prog) the output is different from
<command> or even $(<command>). Example with find (excluding a directory
from search):

$ ls -l /test
total 16
drwxrwxr-x 2 hgb hgb 4096 Nov  6 02:14 a
drwxrwxr-x 2 hgb hgb 4096 Nov  6 02:14 b
drwxrwxr-x 2 hgb hgb 4096 Nov  6 02:14 c
drwxrwxr-x 2 hgb hgb 4096 Nov  6 02:14 d
$ find /test -type d ! -wholename "/test"
/test/c
/test/b
/test/d
/test/a
$ echo "$(find /test -type d ! -wholename "/test")"
/test/c
/test/b
/test/d
/test/a
$ prog='find /test -type d ! -wholename "/test"'
$ echo $prog
find /test -type d ! -wholename "/test"
$ echo "$($prog)"
/test
/test/c
/test/b
/test/d
/test/a
$ 

As seen above /test ist shown when $prog is executed.

I see the same behavior with 
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) (CentOS)
GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu) (debian)


I understand that the above looks crazy and not like a problem out of
real life ... I had to use find to crawl through a huge tree and remove
only a few files in it. I came across the above problem when feeding an
array with the output of find; I fixed it for now by removing the
unwanted entries from the output array.

Thanks in advance for looking into this.

Regards
        -- hgb





reply via email to

[Prev in Thread] Current Thread [Next in Thread]