curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Exit status not reflecting 404 with --fail

From: Ray Satiro via curl-users <curl-users_at_lists.haxx.se>
Date: Mon, 27 Nov 2023 17:06:37 -0500

On 11/27/2023 3:26 PM, Timothe Litt via curl-users wrote:
> On 27-Nov-23 15:02, Paul Gilmartin via curl-users wrote:
>> On 11/27/23 10:09:03, Petr Pisar via curl-users wrote:
>>
>>>>
>>>> Because of dueling package managers, I have a script that parses
>>>> PATH and reports (ls -l) each instance it finds.
>>>>
>>> Bash builtin "type -a" does that.
>> .
>> Thanks.  Trying it, I see it reports both aliases and paths,
>> presumably in search order.
>>
>> I don't see a man page that exactly describes that.
>>
> I didn't mean to start an alternatives discussion.
>
> But in defense of which, you don't need more than this 1 line to
> handle all of the above:
>
> ls -l $(which -a curl | grep -v =)
>
> -a checks aliases and paths.  The grep excludes any alias definitions
> from the ls (their expansions follow and are listed)
>
> If you're not feeding the output into ls (or something else), which -a
> suffices to tell a human what's going on.
>

In Ubuntu 16 LTS type -a will show an alias but which -a won't. For
example I use an alias 'curl.old' for the packaged curl:

owner_at_ubuntu1604-x64-vm:~/tmp/osslroot$ which curl.old
owner_at_ubuntu1604-x64-vm:~/tmp/osslroot$ which -a curl.old
owner_at_ubuntu1604-x64-vm:~/tmp/osslroot$ type -a curl.old
curl.old is aliased to `LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/bin/curl'
owner_at_ubuntu1604-x64-vm:~/tmp/osslroot$ type curl.old
curl.old is aliased to `LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/bin/curl'

If curl.old existed as a program and an alias then which -a would only
show the programs.


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-11-27