All pastes #11412 Raw Edit

Something

public text v1 · immutable
#11412 ·published 2005-05-10 15:20 UTC
rendered paste body
#!/bin/bash

ME=$0

JUSTME=${ME##*/}

if [[ $ME != $JUSTME ]]
then
        LOCATION=${ME%/*}
else
        for P in ${PATH/:/ /}
        do
                if [[ -x $P/$JUSTME ]]
                then
                        LOCATION=$P
                fi
        done
fi

echo "LOCATION is $LOCATION"