While a bit old, the question is still relevant. I met a similar problem
ssh myserver.com 'tail -2 file-header*'
that gave me the error
tail: option used in invalid context -- 2
however, tailing only one file, like
ssh myserver.com 'tail -2 file-header-file-one'
works fine. Looking at the source tail.c shows that tail starts by parsing obsolete options, then parse the rest (i.e. options not processed yet), regular options. However,
parse_obsolete_option() expects an "obsolete" usage, with only one file as argument.
So when providing more files, the function returns immediately, and let the regular parser to choke on
/* With the obsolete form, there is one option string and at most
one file argument. Watch out for "-" and "--", though. */
if (! (argc == 2
|| (argc == 3 && ! (argv == '-' && argv))
|| (3 <= argc && argc <= 4 && STREQ (argv, "--"))))
In conclusion, it is better to always use the
-n regular form, knowing that the "obsolete" code only accepts one file.