#!/bin/bash
abs_path(){
local path=$1
local basename=$( basename $path )
local dirname=$( dirname $path )
cd $dirname
if [ -h $basename ]; then
path=$( readlink $basename )
abs_path $path
else
pwd
fi
}
echo "Bash: $( abs_path $0 )"
阅读(915) | 评论(0) | 转发(0) |