A NOTE has been added to this issue. 
====================================================================== 
https://austingroupbugs.net/view.php?id=1637 
====================================================================== 
Reported By:                nick
Assigned To:                
====================================================================== 
Project:                    1003.1(2016/18)/Issue7+TC2
Issue ID:                   1637
Category:                   Shell and Utilities
Type:                       Clarification Requested
Severity:                   Objection
Priority:                   normal
Status:                     New
Name:                       Nick Stoughton 
Organization:               Logitech 
User Reference:              
Section:                    command 
Page Number:                2596 
Line Number:                84263-84266 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2023-02-27 17:17 UTC
Last Modified:              2023-02-27 18:55 UTC
====================================================================== 
Summary:                    The command utility does not execute aliases
====================================================================== 

---------------------------------------------------------------------- 
 (0006180) kre (reporter) - 2023-02-27 18:55
 https://austingroupbugs.net/view.php?id=1637#c6180 
---------------------------------------------------------------------- 
Yet another case where we would be far better off if the standard
had no aliases.

No surprise that no shells do what the text kind of looks like it
expects, as aliases would have been processed long before the
"command" command is executed - if one wanted to have "command"
apply to aliases (alias values) as well, one could do

alias command='command '

which would expand a following alias after command (as part of lexical
processing) if one appears there.

Without that, "command" is the word in the command word position, if that
is not an alias, no further words get checked to see if they are, until
the
next command word position (which the following word is not, nor is it in
"exec word", xargs word, env word, ... though it can be in "eval word" as
that word is subject to lexical processing (to be tokenised).

The desired action is not adequate however, as it gives no clue what
should
happen in the case in question.   When the word after "command" is a
function,
earlier text says what happens, but nothing does if it is an alias.

However, I agree that as long as aliases remain in POSIX, the text there
needs to be clearer.

I'd suggest something more like adding to the end of the sentence in
question

<blockquote>except that command_word does not appear in the command word
position in the <em>command</em> command, hence is not subject to alias or
reserved word lookups.</blockquote>

Note that command also suppresses reserved words, "command if ..." runs
the
"if" command (from the filesystem, since command suppresses function
lookups,
a function named "if" can't be run this way, even in shells that allow it
to
be defined).

eg:

$ cat $HOME/bin/if
#! /bin/sh

echo If Only.
$ command if args are ignored in that script
If Only.

Every shell I tested behaves like that, as they all should. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2023-02-27 17:17 nick           New Issue                                    
2023-02-27 17:17 nick           Name                      => Nick Stoughton  
2023-02-27 17:17 nick           Organization              => Logitech        
2023-02-27 17:17 nick           Section                   => command         
2023-02-27 17:17 nick           Page Number               => 2596            
2023-02-27 17:17 nick           Line Number               => 84263-84266     
2023-02-27 17:17 nick           Interp Status             => ---             
2023-02-27 17:17 nick           Category                 System Interfaces =>
Shell and Utilities
2023-02-27 18:55 kre            Note Added: 0006180                          
======================================================================


  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to