Monday, 15 February 2010

gnu - What is the purpose of the "-" in sh script line: ext="$(echo $ext | sed 's/\./\\./' -)" -



gnu - What is the purpose of the "-" in sh script line: ext="$(echo $ext | sed 's/\./\\./' -)" -

i porting sh script apparently written using gnu implementation of sed bsd implementation of sed. exact line in script original comment are:

# escape dot in file extension grep ext="$(echo $ext | sed 's/\./\\./' -)"

i able reproduce results next (obviously not exhausting possibilities values ext) :

ext=.h; ext="$(echo $ext | sed 's/\./\\./' -)"; echo [$ext]

using gnu's implementation of sed next returned:

[\.h]

using bsd's implementation of sed next returned:

sed: -: no such file or directory []

executing ext=.h; ext="$(echo $ext | sed 's/\./\\./')"; echo [$ext] returns [\.h] both implementation of sed.

i have looked @ both gnu , bsd's sed's man page have not found trailing "-". googling sed "-" not fruitful either.

is "-" typo? "-" needed unexpected value of $ext? issue not sed, rather sh?

can direct me should looking at, or better, explain purpose of "-" is?

on system, syntax isn't documented in man page, in 'info' page:

sed options... [script] [inputfile...]

if not specify inputfile, or if inputfile -',sed' filters contents of standard input.

given particular usage, think leave off '-' , should still work.

sed gnu sh bsd

No comments:

Post a Comment