* [sisyphus] perl -pi & symlinks
@ 2001-03-22 19:51 Ivan Zakharyaschev
0 siblings, 0 replies; only message in thread
From: Ivan Zakharyaschev @ 2001-03-22 19:51 UTC (permalink / raw)
To: sisyphus
Hello!
Довольно часто для замены текста по образцу в файле используется perl -pi.
Обнаружил неожиданную (для меня) особенность этой команды при работе с
символическими ссылками -- вместо ссылки появляется измененная копия. Вот
демонстрация:
$ MAIN=main LINK=link; touch $MAIN; ln -sf $MAIN $LINK; \
echo a > $LINK; cat $MAIN; ls -l; \
perl -pi -e 's/a/b/' $LINK; cat $MAIN; cat $LINK; ls -l
a
итого 4
lrwxrwxrwx 1 ivan ivan 4 Мар 22 22:44 link -> main
-rw-r--r-- 1 ivan ivan 2 Мар 22 22:44 main
a
b
итого 8
-rw-r--r-- 1 ivan ivan 2 Мар 22 22:44 link
-rw-r--r-- 1 ivan ivan 2 Мар 22 22:44 main
$
После недолгого чтения документации упоминаний этой особенности не
обнаружил. Незнание этого факта может повредить, например, при сборке
пакета.
Best regards,
Ivan.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-03-22 19:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-22 19:51 [sisyphus] perl -pi & symlinks Ivan Zakharyaschev
ALT Linux Sisyphus discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
public-inbox-index sisyphus
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.sisyphus
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git