Having just run across an cross-compatibility issue for ex and its -c argument,
please consider a proposal to improve the ex command man page to add
information about the argument's supported syntax.
The ex -c command-line argument implementation varies from system to system.
This is documented in gvim's ex command man page.
$ man ex
...
−c command
Specify an initial command to be executed in the first edit
buffer loaded from an existing file (see the EXTENDED
DESCRIPTION section). Implementations may support more than
a single −c option. In such implementations, the specified
commands shall be executed in the order specified on the com‐
mand line.
...
Today I found that some ex commands written on a Linux system, with multiple
-c arguments, silently failed on an older UNIX system (with no error result).
While investigating, the man page was consulted:
$ man ex
...
-c command
Execute the specified command at start up. Individual
commands can be separated by vertical bar characters
``|``.
...
This UNIX variant of ex DOES NOT support multiple -c arguments, but does allow
support multiple commands via vertical bar delimiters, and it was possible to
rewrite the ex command:
ex -c 's/foo/bar/|wq' file.txt
vs.
ex -c 's/foo/bar/' -c wq file.txt
Further investigation shows that the gvim variant of the ex command DOES
actually implement the vertical bar command delimiter, thereby making it
possible to write cross-platform ex commands.
It seems unfortunate for gvim's ex man page not to document use of the
vertical bar delimiter in lieu of multiple -c arguments since it does
mention that not all implementations support use of multiple -c
arguments.
I only have 8.0 and older installed on systems, so there is a slight
possibility this has changed since 8.0, but its probably not
unreasonable to think that the issue persists in later
version man pages.
Regards,
Kevin R. Bulgrien
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.