SPUG: $0 dispatch for named links (on Windows without links)

Michael R. Wolf MichaelRWolf at att.net
Mon Jun 23 08:53:43 PDT 2008

I want to have one script that does different things based on $0 (think vi
vs vim).  If it were a vanilla *nix issue, I'd make many hard links and
branch based on $0, but since Windows (or more accurately some combination
of emacs and cygwin creating a useful interface to the native OS) doesn't
preserve links across edit cycles, I'm left with one updated file and N-1
co-linked old versions.

I tried to use the 'exec' trick to "lie to the program you are executing
about its own name" trick, but it doesn't work on my cygwin (nor even from
XP's command line).

    exec {"$FindBin::Bin/real_name"} 'fake_name', @ARGV;

Does anyone have a better (for the "less fragile" definition of "better")


Michael R. Wolf
    All mammals learn by playing!
        MichaelRWolf at att.net

More information about the spug-list mailing list