export PATH results in: bash ls No such file or directory

Hi,
I’d appreciate anyone shedding light on the following:

In bash I thought parentheses just controlled the order of
execution/expansion.
The following works fine.

Code:

> su -
Password:
pm:~ # ls |head -n 1
.DCOPserver_mvlaptop_:0
pm:~ # export PATH=/tmp:$PATH
pm:~ # echo $PATH
/tmp:/sbin:/usr/sbin:/usr/local/sbin:/opt/kde3/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/NX/bin
pm:~ # ls |head -n 1
.DCOPserver_mvlaptop_:0
pm:~ # exit


So, given the echo outputs the same contents as above, is the following
behavior a bug?

Code:

> su -
Password:
pm:~ # ls |head -n 1
.DCOPserver_mvlaptop_:0
pm:~ # export PATH=(/tmp:$PATH)
pm:~ # echo $PATH
/tmp:/sbin:/usr/sbin:/usr/local/sbin:/opt/kde3/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/NX/bin
pm:~ # ls |head -n 1
-bash: head: No such file or directory
-bash: ls: No such file or directory



mvyver

mvyver’s Profile: http://forums.opensuse.org/member.php?userid=628
View this thread: http://forums.opensuse.org/showthread.php?t=405024

That’s the wrong syntax. It should be just

export PATH="/tmp:$PATH"

The ()s have a meaning in bash, and not what you expect. Hint: arrays.


ken_yap

ken_yap’s Profile: http://forums.opensuse.org/member.php?userid=221
View this thread: http://forums.opensuse.org/showthread.php?t=405024