Results 1 to 2 of 2

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

  1. #1
    mvyver NNTP User

    Default 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


  2. #2
    ken yap NNTP User

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


    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •