I'm running perl on cygwin and trying to do the following one liner:

perl -pi -e 'BEGIN{$pwd=`pwd`;} s/^HOME=.*/HOME=$pwd/;' makeinclude

which will replace the line
HOME=/home/whoever
with
HOME=(whever I happen to be at the moment)
in my makinclude file

However, cygwin apparently does not like that and will just delete
makinclude.  cygwin apparently only works when you supply a suffix to i
perl -pi.bak -e ...

But I don't want a backup made of the file, so I have to unlink it

perl -pi.bak -e 'BEGIN{$file=$ARGV[0]; $pwd=`pwd`;} s/^HOME=.*/$pwd/;
END{unlink($file . ".bak");}'

Now this is just UGLY!  Is there an easier way (even not in perl) to get
what I want.

Thanks!
Tanton


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to