Results 1 to 2 of 2

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

  1. #1

    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

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

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

    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.

Posting Permissions

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