I noticed a strange behaviour when applying an edit using sed -i
on a symlink. The documentation sais -i
will do an in-place edit. However, the symlink is replaced with a file.
Steps to reproduce:
cd /tmp
echo blah > foo
ln -s foo bar
sed -i -e 's/ah/ub/' bar
ls -l
will result in:
-rw-rw-r--. 1 arogge arogge 5 Mar 9 15:07 bar
-rw-rw-r--. 1 arogge arogge 5 Mar 9 15:07 foo
Is this intended behaviour or is it a bug in sed
?
-c
makes sed do what I thought it should do anyways – Mar 09 '18 at 14:12