3 # This is a shell script to find the 'RealBin' and 'RealScript' for the
7 # 1.0.1 - Basic release.
12 # Prints the absolute path of the given input directory.
13 # Usage: abs=`abs_path <dirName>`
17 if [ "$?" = "0" ]; then
23 # Finds the file from the 'PATH' environmental variable
24 # and then prints it's dir name.
25 # Usage: fromPATH <file>
33 if [ -r "$temp" ]; then
34 temp
=`/usr/bin/dirname "$temp"`
42 # Equivalent to perl's FindBin::RealBin
43 # Usage: RealBin <file>
47 if [ -r "$file" ]; then
48 temp
=`/usr/bin/dirname "$file"`
55 # Equivalaent to perl's FindBin::RealScript
56 # Usage: RealScript <file>
57 function RealScript
() {
59 local temp
=`RealBin "$file"`
60 temp
=$temp/`/bin/basename "$file"`
61 temp
=`/usr/bin/readlink -f "$temp"`
62 if [ "$temp" != "" ]; then
69 echo " FindBin.sh - Bash equivalent for Perl's FindBin.
71 FindBin.sh [-h, -v] [-bin | -script] <file>
72 -h Print this help and exit.
73 -v Print version information and exit.
74 -bin Print the value of FindBin::RealBin.
75 -script Print the value of FindBin::RealScript.
76 <file> The file whose FindBin::RealBin & FindBin::RealScript
82 function showVersion
() {
83 echo "FindBin.sh - v1.0.1"
89 if [ "$1" = "-h" ]; then
91 elif [ "$1" = "-v" ]; then
93 elif [ "$1" = "-bin" ]; then
96 elif [ "$1" = "-script" ]; then