On AIX (but this happens on HP-UX as well), I have GNU ls in my path
and it is also aliased as ls
.
But when i use xargs, it uses the standard Unix ls instead of the alias.
For example (flocate
is a function which finds the exact path of
the search subject):
flocate mirrorvg | xargs ls -lh
ls: illegal option -- h
usage: ls [-1ACFHLNRSabcdefgiklmnopqrstuxEUX] [File...]
ls -lh /usr/sbin/mirrorvg
-r-xr-x--- 1 root system 37K apr 3 2014 /usr/sbin/mirrorvg*
Why doesn't xargs use the ls
alias?
ls
executable in your$PATH
environment variable, and does it precede the directory (probably/bin
) containing the non-GNUls
command? Please update your question to show us the actual value of your$PATH
.xargs
will execute the firstls
command that it finds in a directory in your$PATH
; it doesn't know about aliases. – Keith Thompson yesterday