我将此行添加到我的 ~/.bashrc
. /mnt/c/Users/enzo/drive/projects/dotfiles/init.sh
Run Code Online (Sandbox Code Playgroud)
并且在 init.sh 中,我正在尝试获取路径,init.sh但无法获取。
到目前为止我试过这个:
CURDIR=`/bin/pwd`
BASEDIR=$(dirname $0)
ABSPATH=$(readlink -f $0)
ABSDIR=$(dirname $ABSPATH)
REAL=$(realpath $0)
echo "CURDIR is $CURDIR"
echo "BASEDIR is $BASEDIR"
echo "ABSPATH is $ABSPATH"
echo "ABSDIR is $ABSDIR"
echo "REAL is $REAL"
Run Code Online (Sandbox Code Playgroud)
输出:
CURDIR is /mnt/c/Users/enzo
BASEDIR is /bin
ABSPATH is /bin/bash
ABSDIR is /bin
REAL is /bin/bash
Run Code Online (Sandbox Code Playgroud)
我在 linux 的 windows 子系统下。