相当于nushell
下面的 bash.
if [[ -d $LOCATION ]]; then
elif [[ -f $LOCATION ]]; then
fi
答案1
我觉得我缺少一种更实用的方法来做到这一点,但是:
if ($LOCATION | path type) == "file" {
echo "It's a file."
} else if ($LOCATION | path type) == "dir" {
echo "It's a directory"
}