sed argument processing b0rked?
Lars Kellogg-Stedman
lars at oddbit.com
Tue Jun 21 15:24:39 UTC 2011
>> sed -i'' -e 's/^\(REVOKE ALL ON SCHEMA public FROM \)postgres/\1pgsql/' \
> ? -e 's/^\(GRANT ALL ON SCHEMA public TO \)postgres/\1pgsql/' \
> ? /tmp/pgdump
> sed: -e: No such file or directory
If you put a space after -i:
sed -i '' ...
It will work. The '-i' option takes an argument, and if you put a
null argument right next to it, with no spaces, the shell doesn't see
anything there. That is, this:
-i''
Is exactly equivalent to this:
-i
Which means that sed is consuming the following argument as the
extension...so the first '-e' is the argument to the '-i' option.
-- Lars
More information about the freebsd-questions
mailing list