Force "ls" to show .exe extension

Eric Blake
Tue Jan 6 21:38:00 GMT 2015

On 01/06/2015 02:28 PM, Paul wrote:
> Paul <Paul.Domaskis <at>> writes:
>> Both solutions are great.  I'll set the --append-exe in my bash
>> aliases, and for systems outside of my normal working environment
>> (e.g., working with someone on their unix sessions), I know I can
>> force display of .exe using asterisk.
> Drat. If I pipe files to 'xargs ls', the unaliased ls command is used:
>    type -pa pdfcrop | xargs ls

alias xargs='xargs '

Then the alias expansion of xargs will in turn allow alias expansion of
the next argument.  (Except that you then have to also create
trailing-space aliases for all options you commonly pass to xargs
between 'xargs' and the final command name).

Sadly, xargs is one of the cases where shell functions won't help (xargs
doesn't execute the shell function).  Your other solution is to modify
$PATH to point to a directory under your control as the first thing,
where 'cat /your/ls' contains:
exec /bin/ls --append-exe "$@"

such that your script then gets picked up by xargs, and you no longer
have to worry about aliases.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Cygwin mailing list