2012/10/18 Keith Marshall <firstname.lastname@example.org>
On 18/10/12 20:13, Renato Silva wrote:I'm sure they would, but hard links are cheaper, and they don't require...
> Thanks! yes, I like the link idea... Yes it is NTFS, but wouldn't symlinks
> work too?
...any such support from the operating system, (nor from any add-on).
OTOH, hard links can only be used with physical disk files, and they
cannot span devices, (neither of which represents a problem in the
scenario under discussion).
You can infer the name of the command from the link name itself;
> IIRC it is possible to get symlink name from a linked script (that
> is, to determine which command to call in the wrapper).
something along the lines of:
or, if you need to insert a command specific path:
case $CMD in
bzr) /path/to/$CMD.exe "$@" ;;
should do the trick, for either hard links or for symlinks.
Thanks, I didn't know or remember basename worked for links. So I have implemented something better than aliases with a script called /local/bin/runcrt.sh:
env -u TZ $(basename "$0").exe "$@"
Then I created symlinks, ruby, python and bzr for now, pointing to that script. They work, except for ruby, which is used in /etc/profile exactly to build value for TZ (through my posix-brst.rb script). When called from path in profile, ruby will run as a bash script (runcrt.sh), which for some reason causes /etc/profile, and even ~/.profile, and even on BASH_ENV="/not/etc/profile", to be recursively sourced, leading to bash not starting at all and adding a growing list of processes in task manager.
My workaround was to rather call the raw ruby executable directly in /etc/profile, like this:
export TZ="BRT+3BRST$($rubyexe /local/bin/posix-brst.rb)"