A NOTE has been added to this issue. ====================================================================== http://austingroupbugs.net/view.php?id=1161 ====================================================================== Reported By: steffen Assigned To: ====================================================================== Project: 1003.1(2016)/Issue7+TC2 Issue ID: 1161 Category: Shell and Utilities Type: Clarification Requested Severity: Editorial Priority: normal Status: New Name: steffen Organization: User Reference: Section: command Page Number: 2596 Line Number: 84274 ff. Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2017-09-04 13:09 UTC Last Modified: 2017-09-05 12:34 UTC ====================================================================== Summary: command -v must find something executable ======================================================================
---------------------------------------------------------------------- (0003825) steffen (reporter) - 2017-09-05 12:34 http://austingroupbugs.net/view.php?id=1161#c3825 ---------------------------------------------------------------------- re kre: To me the problem is that number one, and the most widely used alternative shell on the most widely used Unix (alike) system, and the one which claims to be POSIX exactly and is understood like that by i think many normal users, has introduced this behaviour. You ask for a command and can possibly get a plain text file, for a reason i do not understand. So what i thought could be achieved with command -v effectively needs thecmd() { fail=${1} pname=${2} oifs=${IFS} IFS=: set -- ${PATH} IFS=${oifs} for path do if [ -x "${path}/${pname}" ]; then echo "${path}/${pname}" return 0 fi done [ ${fail} -eq 0 ] && return 1 echo >&2 'ERROR: no trace of utility '"${pname}" exit 1 } Unless you want to be very backward compatible and replace [(1) with test(1) in addition (thanks for Ralph and his favourite autotools). I never understood why i cannot say "IFS=: set -- $PATH", by the way, has anyone an answer for this? csh is not standardized by POSIX and thus no reason to not go for which, which seems to be what users are forced to head for? I do not know, being more explicit in the standard and thus turning behaviour found in the wild to be buggy is an option. Issue History Date Modified Username Field Change ====================================================================== 2017-09-04 13:09 steffen New Issue 2017-09-04 13:09 steffen Name => steffen 2017-09-04 13:09 steffen Section => command 2017-09-04 13:09 steffen Page Number => 2596 2017-09-04 13:09 steffen Line Number => 84274 ff. 2017-09-04 15:49 kre Note Added: 0003821 2017-09-05 06:58 stephane Note Added: 0003823 2017-09-05 08:30 stephane Note Added: 0003824 2017-09-05 12:34 steffen Note Added: 0003825 ======================================================================