Doubts on sed (option -f, script-file)

I'm playing with sed.

echo "s/own/my/" > "/tmp/myscript.sed"
sed "--file=/tmp/myscript.sed" <<< "my own string"
my my string

If I do:

sed "-f /tmp/myscript.sed" <<< "my own string"
sed: cannot open file /tmp/myscript.sed: File or directory does not exist

Without double quotes around -f ...:

sed -f /tmp/myscript.sed <<< "my own string"
my my string

So, it works as expected. Anyone can explain it to me?

Read more here:

Content Attribution

This content was originally published by giovannipa at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: