Discussion:
[Help-bash] Overwriting of data in a file
Greg Wooledge
2018-06-04 13:12:24 UTC
Permalink
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.
sed -i
Editing files with a shell script is just fundamentally broken. Don't
try it. Write the entire new file out.

Loading...