bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gawk - 'inplace' feature ignores file's access flags (rea


From: Andrew J. Schorr
Subject: Re: [bug-gawk] gawk - 'inplace' feature ignores file's access flags (read-only)
Date: Wed, 10 Jun 2015 08:35:22 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

Hi Janis,

On Wed, Jun 10, 2015 at 01:08:43PM +0200, Janis Papanagnou wrote:
> The 'inplace' feature ignores access flags of files; if the
> file is write protected it will nonetheless be overwritten.

Are you sure this is a bug?  It appears that sed behaves the same way:

Sed:

bash-4.2$ echo hello > tester
bash-4.2$ chmod -w tester
bash-4.2$ ls -l tester
-r--r--r-- 1 schorr ead 6 Jun 10 08:31 tester
bash-4.2$ sed -i -e s/hello/goodbye/ tester && echo YES
YES
bash-4.2$ cat tester
goodbye
bash-4.2$ ls -l tester
-r--r--r-- 1 schorr ead 8 Jun 10 08:31 tester

Gawk:

bash-4.2$ echo hello > tester
bash-4.2$ chmod -w tester
bash-4.2$ ls -l tester
-r--r--r-- 1 schorr ead 6 Jun 10 08:32 tester
bash-4.2$ gawk -i inplace '{gsub(/hello/,"goodbye"); print}' tester
bash-4.2$ cat tester
goodbye
bash-4.2$ ls -l tester
-r--r--r-- 1 schorr ead 8 Jun 10 08:33 tester

Regards,
Andy



reply via email to

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