Mighty Morph'n Symbolic Links



  • All I can say is, "What on Earth?"

    Macintosh:bin tbal$ python2.4 -V
    Python 2.4.4
    Macintosh:bin tbal$ python2.5 -V
    Python 2.5.1
    Macintosh:bin tbal$
    which python2.4
    /opt/local/bin/python2.4
    Macintosh:bin tbal$ sudo ln -s /opt/local/bin/python2.4 /opt/local/bin/python
    Macintosh:bin tbal$ which python
    /opt/local/bin/python
    Macintosh:bin tbal$ python -V
    Python 2.5.1
    Macintosh:bin tbal$ ls -l /opt/local/bin/python
    lrwxr-xr-x  1 root  admin  24 Mar 14 14:08 /opt/local/bin/python -> /opt/local/bin/python2.4
    Macintosh:bin tbal$

     I even tried it with a hard link. Same thing.

    The best part is I created a script called: /opt/local/bin/python that contains:

    python2.4 $*

    And it worked great. 



  • hash -r

     

    BASH keeps a hashtable of already found commands whereas there which command searches the path.  Read the man page for BASH.



  • 1. Go back to the symlink, it DOES work great too. And if it doesn't...

    2. your shell script is broken, if you call it with an argument with a space in it. Replace it by

    exec python2.4 "$@" 


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.