[comp.unix.internals] parsing current filename in ex

kumarr@ivan.hf.intel.com (Kumar Ranganathan) (12/15/90)

I am sourcing a file containing the following ex command script from within a 
vi edit of file XXX:

!ex - %.lst < commands


ex will therefore attempt to execute the contents of commands on XXX.lst 
since the current filename is XXX by default.

This is my problem:

If I am editing a file called XXX.c in vi and want to execute the contents
of commands on XXX.lst, the above sequence of commands will not work since
it will try to execute commands on XXX.c.lst and this is not what I wanted.
Note that XXX represents an arbitrary file name, not the literal 'XXX'.

Any pointers on how to do this will be appreciated.