Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

For directories dirname gets tripped for ../ and returns ./.

nolan6000's functionnolan6000's function can be modified to fix that:

get_abs_filename() {
  # $1 : relative filename
  if [ -d "${1%/*}" ]; then
    echo "$(cd ${1%/*}; pwd)/${1##*/}"
  fi
}

For directories dirname gets tripped for ../ and returns ./.

nolan6000's function can be modified to fix that:

get_abs_filename() {
  # $1 : relative filename
  if [ -d "${1%/*}" ]; then
    echo "$(cd ${1%/*}; pwd)/${1##*/}"
  fi
}

For directories dirname gets tripped for ../ and returns ./.

nolan6000's function can be modified to fix that:

get_abs_filename() {
  # $1 : relative filename
  if [ -d "${1%/*}" ]; then
    echo "$(cd ${1%/*}; pwd)/${1##*/}"
  fi
}
Adding link, trying to clear up formatting
Source Link
cfi
  • 11.2k
  • 9
  • 58
  • 105

For directories dirname gets tripped for ../ and returns ./.

nolan6000's function can be modified to fix that:

for just directories dirname gets tripped for ../ 
it returns ./
nolan's function can be modified to fix that

    get_abs_filename() {
      # $1 : relative filename
      if [ -d "${1%/*}" ]; then
        echo "$(cd ${1%/*}; pwd)/${1##*/}"
      fi
    }
get_abs_filename() {
  # $1 : relative filename
  if [ -d "${1%/*}" ]; then
    echo "$(cd ${1%/*}; pwd)/${1##*/}"
  fi
}
for just directories dirname gets tripped for ../ 
it returns ./
nolan's function can be modified to fix that

    get_abs_filename() {
      # $1 : relative filename
      if [ -d "${1%/*}" ]; then
        echo "$(cd ${1%/*}; pwd)/${1##*/}"
      fi
    }

For directories dirname gets tripped for ../ and returns ./.

nolan6000's function can be modified to fix that:

get_abs_filename() {
  # $1 : relative filename
  if [ -d "${1%/*}" ]; then
    echo "$(cd ${1%/*}; pwd)/${1##*/}"
  fi
}
added 9 characters in body
Source Link

for just directories dirname gets tripped for ../ it returns ./ nolan's function can be modified to fix that

get_abs_filename() {
  # $1 : relative filename
  if [ -d "${1%/*}" ]; then
    echo "$(cd ${1%/*}; pwd)/${1##*/}"
  fi
}
for just directories dirname gets tripped for ../ 
it returns ./
nolan's function can be modified to fix that

    get_abs_filename() {
      # $1 : relative filename
      if [ -d "${1%/*}" ]; then
        echo "$(cd ${1%/*}; pwd)/${1##*/}"
      fi
    }

for just directories dirname gets tripped for ../ it returns ./ nolan's function can be modified to fix that

get_abs_filename() {
  # $1 : relative filename
  if [ -d "${1%/*}" ]; then
    echo "$(cd ${1%/*}; pwd)/${1##*/}"
  fi
}
for just directories dirname gets tripped for ../ 
it returns ./
nolan's function can be modified to fix that

    get_abs_filename() {
      # $1 : relative filename
      if [ -d "${1%/*}" ]; then
        echo "$(cd ${1%/*}; pwd)/${1##*/}"
      fi
    }
Source Link
Loading