[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to overwrite a symbolic link?
From: |
Peng Yu |
Subject: |
Re: How to overwrite a symbolic link? |
Date: |
Thu, 6 May 2010 15:02:37 -0500 |
On Thu, May 6, 2010 at 10:53 AM, Pierre Gaston <pierre.gaston@gmail.com> wrote:
> On Thu, May 6, 2010 at 5:53 PM, Peng Yu <pengyu.ut@gmail.com> wrote:
>> Suppose that I have a symbolic link link1 pointing to file1. When I
>> write to link1, I don't want file1 change. I want it to remove the
>> link generated a new file and write to it.
>>
>> pipe '>' will change file 1. I'm wondering if there is way to do so,
>> so that I don't have to test whether it is a symbolic link or not
>> explicitly.
>>
> rm link1
Is there a way to overload operators like '>' and '>>' in bash, just
as overloading in C++, etc. Suppose I have already made some bash
program using '>' and '>>' without thinking about symbolic link, but I
begin aware of them later. I would be cumbersome to add a test
statement and deciding whether 'rm' or not for each usage of '>' and
'>>'.
A more general question is how to change the behavior of a program
(for example compiled from C code) to delete symbolic link and write a
new file, without recompiling the program.
--
Regards,
Peng
Re: How to overwrite a symbolic link?, Marc Herbert, 2010/05/07