This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Force "ls" to show .exe extension


On 01/06/2015 02:28 PM, Paul wrote:
> Paul <Paul.Domaskis <at> gmail.com> 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:
#!/bin/sh
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 http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]