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

sed -i turns link into file



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I encountered something rather odd and in my eyes disturbing: if I edit
a symlinked file with an ordinary editor (nano, kate, ...) the editor
edits the file instead and leaves the symlink intact.

If I 'edit' the same symlink via "sed -i", the symlink gets replaced by
the saved file and the linked file is not changed.

Is this normal behaviour? Is there a way to tell sed to edit the link's
target instead?

Thanks!

Johannes

/----------
Example:

17:45:50-jw@johannes2:~/tmp/test$ ln -s atest alink
17:45:58-jw@johannes2:~/tmp/test$ ll
total 4
lrwxrwxrwx 1 jw jw  5 2008-01-17 17:45 alink -> atest
- -rw-r--r-- 1 jw jw 55 2008-01-17 17:36 atest
17:46:00-jw@johannes2:~/tmp/test$ sed -i s/test/succes/g alink
17:46:19-jw@johannes2:~/tmp/test$ ll
total 8
- -rw-r--r-- 1 jw jw 57 2008-01-17 17:46 alink
- -rw-r--r-- 1 jw jw 55 2008-01-17 17:36 atest

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHj4boC1NzPRl9qEURAks7AJ9tq6ZjYBKUilRyo8h2QvGuAJSQ7wCeOXtA
DifbuKyg/E0iqOS16BBLqBU=
=Xt2w
-----END PGP SIGNATURE-----


Reply to: