bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnu-libiconv] Add -i inplace option for iconv.


From: Bruno Haible
Subject: Re: [bug-gnu-libiconv] Add -i inplace option for iconv.
Date: Tue, 31 Jul 2018 00:55:56 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-130-generic; KDE/5.18.0; x86_64; ; )

Heikki Orsila wrote:
> so why not just create it for iconv tool like "sed -i" does?

As I said: it violates the Unix philosophy. Read about it in [1][2].

> So I thought of writing a suitable shell script that would use
> 
>       $(tempfile -d "$(dirname "$f")") || error_check
> 
> and realized everyone who needs this use-case is just doing redundant work,

That's true. The logic for creating a temp file is something needed
frequently in various places.

So why don't you create a program named, say, 'inplace', with the property
that

   inplace PROGRAM ARGUMENTS... FILE

does essentially (but with more correct placement and handling of
the temporary file and symlinks):

   mv FILE FILE'~' && PROGRAM ARGUMENTS... < FILE'~' > FILE && rm -f FILE'~'

Such a program would fit well with the Unix philosophy. You could even
propose it for inclusion in the 'coreutils'.

Bruno

[1] https://en.wikipedia.org/wiki/Unix_philosophy
[2] https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch01s06.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]