1#!/bin/bash 2 3# Just in case realpath doesn't exist, try a perl approach. 4function get_real_path() 5{ 6 if realpath $0 &> /dev/null; then 7 realpath $0 8 return 9 fi 10 perl -e 'use Cwd "abs_path";print abs_path(shift)' $0 11} 12