help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Overwriting of data in a file


From: Greg Wooledge
Subject: Re: [Help-bash] Overwriting of data in a file
Date: Mon, 4 Jun 2018 09:12:24 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Mon, Jun 04, 2018 at 07:38:20AM -0400, Bernard Fay wrote:
> The problem is that an entry like "/root" will overwrite an exiting entry
> or "/root/.cshrc" therefore creating a double entry for "/root" and adding
> a new entry for "/root/.cshrc".

Simply rewrite the ENTIRE file.  Done.

> PERMFILE=permissions.local
> for VAL in ${ELMT[*]}; do

STOP using all-caps variable names.

A full array expansion should be "address@hidden" with @ sign and quotes.

>           sed -i 

Editing files with a shell script is just fundamentally broken.  Don't
try it.  Write the entire new file out.



reply via email to

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