David Korn wrote: > Subject: Re: [ksh93-integration-discuss] [Bug 399] New: "alias.sh" may > execute the wrong command > -------- > > > ... if PATH is /usr/xpg4/bin:/usr/bin, a "ls" builtin is bound to > > > /usr/bin/ls > > > and the script should execute the "ls" builtin it will execute > > > /usr/xpg4/bin/ls > > > instead of the builtin command because /usr/xpg4/bin comes before > > > /usr/bin in > > > PATH. > > I must be missing something. If ls is a builtin for /usr/bin/ls > but /usr/xpg4/bin comes before /usr/bin in PATH, then ls should run > /usr/xpg4/bin/ls, not the built-in version of /usr/bin/ls. > > That is the whole point of binding a builtin to a path name rather than > just making ls a builtin.
Erm... yes... but in this case it's a bit different: Assume /usr/bin/ls is a ksh93 shell script which calls a ksh93 builtin called "ls" (which is bound to /usr/bin/ls) like this: -- snip -- #!/usr/bin/ksh93 ls "$@" -- snip -- In this case the call to "ls" will walk all elements in ${PATH} and check whether there is a "ls" command. If any path element before /usr/bin/ contains an command called "ls" then this script (itself being the _file_ called /usr/bin/ls) will execute that command instead of the (intended) builtin bound to /usr/bin/ls ... ;-/ Originally I thought that I can just place a $ export PATH=/usr/bin # at the top of the script to get rid of the issue... but then I realised that this will break the "type" builtin (which is available as a shell script called /usr/bin/type in Solaris). ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.mainz at nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 7950090 (;O/ \/ \O;)