sed-4.2.1 替換文件內容後變成只讀文件

D:\zDown\00>cat test.txt
000
111
222
333

D:\zDown\00>attrib
A       I            D:\zDown\00\test.txt

D:\zDown\00>sed -i -e "s/$/&TTT/g" test.txt
sed: preserving permissions for `./sed003936': Permission denied

D:\zDown\00>attrib
A    R               D:\zDown\00\test.txt

D:\zDown\00>cat test.txt
000TTT
111TTT
222TTT

D:\zDown\00>sed --version
GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.

GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-gnu-utils@gnu.org>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

D:\zDown\00>

 今天遇到的問題,百思不解爲何,後來換個sed-4.2.2 版本試了一下html

D:\zDown\00>attrib -R +I

D:\zDown\00>attrib
A       I            D:\zDown\00\test.txt

D:\zDown\00>cat test.txt
000TTT
111TTT
222TTT

D:\zDown\00>sed-4.2.2 -i -e "s/$/&TTT/g" test.txt

D:\zDown\00>attrib
A       I            D:\zDown\00\test.txt

D:\zDown\00>cat test.txt
000TTTTTT
111TTTTTT
222TTTTTT

D:\zDown\00>sed-4.2.2 --version
sed-4.2.2 (GNU sed) 4.2.2
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed@gnu.org>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

D:\zDown\00>

sed-4.2.2 就正常,發現MSYS自帶的sed版本確實有這個BUGredis

相關文章
相關標籤/搜索