How to prevent sed -i command overwriting my symlinks on Linux or Unix

How to prevent sed -i command overwriting my symlinks on Linux or Unix

I recently ran a command ‘sed -i 's/CONFIG_1/CONFIG_OPT_2/g' /etc/nginx/sites-enabled/*.conf‘ on a Debian Linux server. However, the sed command destroyed the link and created a regular file in place of the link file. How can I prevent my ‘sed -i’ command from destroying symlinks on Linux or Unix-like system?
Halal Vitamins

Powered by WPeMatico

Leave a Reply

Your email address will not be published. Required fields are marked *