How to expand relative paths in shell script

前端 未结 7 1253
春和景丽
春和景丽 2021-02-06 21:49

I am writing a script to set environment variables on linux 2.6 using bash. So the script contains commands like:

export SRC_DIR=..
export LIBPATH=${SRC_DIR}/lib         


        
7条回答
  •  温柔的废话
    2021-02-06 22:43

    For keeping error code:

    function getPwd() {
        $(cd $1; [[ $? -ne 0 ]] && exit 1 || echo echo $PWD;)
        return $?
    }
    

提交回复
热议问题