get_abs_filename.lib 301 B

1234567891011
  1. # 相对路径转绝对路径
  2. lib_get_abs_filename() {
  3. filename=$1
  4. parentdir=$(dirname "${filename}")
  5. if [ -d "${filename}" ]; then
  6. echo "$(cd "${filename}" && pwd)"
  7. elif [ -d "${parentdir}" ]; then
  8. echo "$(cd "${parentdir}" && pwd)/$(basename "${filename}")"
  9. fi
  10. }