The problem is that Mac OS X uses the BSD version of sed
, which treats the -i
option slightly differently. The GNU version used in Linux takes an optional argument with -i
: if present, sed
makes a backup file whose name consists of the input file plus the argument. Without an argument, sed
simply modifies the input file without saving a backup of the original.
In BSD sed
, the argument to -i
is required. To avoid making a backup, you need to provide a zero-length argument, e.g. sed -i '' y.tab.c ...
.
Your command, which simply edits y.tab.c
with no backup in Linux, would attempt to save a backup file using 'y.tab.c' as an extension. But now, with no other file in the command line, sed
thinks you want to edit standard input in-place, something that is not allowed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…