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: Avoiding overwriting a symlinked target

From: Paul Gilmartin via curl-users <curl-users_at_lists.haxx.se>
Date: Mon, 3 Jan 2022 08:07:35 -0700

On Jan 2, 2022, at 20:57:29, Dirk Fieldhouse via curl-users <curl-users_at_lists.haxx.se> wrote:
>
>> ...?
> Thanks, Daniel. In the case I'm describing, the aim is to specify a
> single command-line that safely downloads the utility, without having to
> say 'first unlink any existing file' or relying on the user's system
> having an unlink command or the user having configured a POSIX shell. By
> 'safely', I mean being confident that the suggested command-line won't
> break the user's system, even if we are telling the user to become admin
> and download into the $PATH.
>
Rely on shell facilities (bash att least):
    set -o noclobber
    curl URL >utility

But, in the end, "Mit der Dummheit kämpfen Götter selbst vergebens."

-- gil

-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-01-03