Macbook Pro 13" 2016, High Sierra 10.13.2
我知道终端无法打开/ cd 带有空格的文件夹,除非存在符号\
,或者" "
空格或整个文件夹名称。但是,终端和 iTerm 仍然存在问题。
*****:~ #######$ cd /Users/#######Google\ Drive
-bash: cd: /Users/#######/Google: No such file or directory
*****:~ #######$ cd Google\ Drive/
-bash: cd: Google: No such file or directory
*****:~ #######$ cd Google' 'Drive/
-bash: cd: Google: No such file or directory
*****:~ #######$ cd 'Google Drive'/
-bash: cd: Google: No such file or directory
*****:~ #######$ cd "Google Drive"
-bash: cd: Google: No such file or directory
*****:~ #######$ cd Google" "Drive
-bash: cd: Google: No such file or directory
Google 云端硬盘通过 可见ls
。
Google Drive 还具有自动完成功能(键入Goo
并按 Enter)和将文件夹从 Finder 拖放到终端,终端\
会自行插入并为您提供Google\ Drive/
.
此行为可能与我的 Mac 上的所有文件夹有关。这已经发生了一段时间,我想解决它。
PS问题主要发生在cd
命令上。
更新。
根据要求,这是 stivens 的输出 ~ $ ls -d Google*Drive | xxd 00000000:476f 6f67 6c65 2044 7269 7665 0a 谷歌驱动器。
和type cd
stivens ~ $ type cd
cd is a function
cd ()
{
unset RETVAL;
if __gvm_is_function __gvm_oldcd; then
__gvm_oldcd $*;
fi;
local dot_go_version dot_go_pkgset rslt;
local defaults_go_name defaults_go_pkgset;
local defaults_resolved=false;
local defaults_hash;
defaults_hash=();
if [[ "$GVM_ROOT" == "" ]]; then
__gvm_display_error "GVM_ROOT not set. Please source \$GVM_ROOT/scripts/gvm";
return $?;
fi;
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "Resolving defaults...";
__gvm_read_environment_file "${GVM_ROOT}/environments/default" > /dev/null;
rslt=$?;
defaults_hash=(${RETVAL});
if [[ $rslt -eq 0 ]]; then
defaults_resolved=true;
else
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "Can't find default environment. Falling back to system.";
__gvm_read_environment_file "${GVM_ROOT}/environments/system" > /dev/null;
rslt=$?;
defaults_hash=(${RETVAL});
if [[ $rslt -eq 0 ]]; then
defaults_resolved=true;
else
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "Can't find system environment.";
fi;
fi;
if [[ "${defaults_resolved}" == false ]]; then
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "Resolving fallback go version and pkgset from all available.";
local fallback_go_version="";
__gvm_resolve_fallback_version > /dev/null;
fallback_go_version="${RETVAL}";
local fallback_go_pkgset="";
__gvm_resolve_fallback_pkgset "${fallback_go_version}" > /dev/null;
fallback_go_pkgset="${RETVAL}";
{
setValueForKeyFakeAssocArray "gvm_go_name" "${fallback_go_version}" "${defaults_hash[*]}" > /dev/null;
defaults_hash=(${RETVAL});
setValueForKeyFakeAssocArray "gvm_pkgset_name" "${fallback_go_pkgset}" "${defaults_hash[*]}" > /dev/null;
defaults_hash=(${RETVAL})
};
unset fallback_go_version;
unset fallback_go_pkgset;
defaults_resolved=true;
fi;
defaults_go_name="";
defaults_go_pkgset="";
{
valueForKeyFakeAssocArray "gvm_go_name" "${defaults_hash[*]}" > /dev/null;
defaults_go_name="${RETVAL}";
valueForKeyFakeAssocArray "gvm_pkgset_name" "${defaults_hash[*]}" > /dev/null;
defaults_go_pkgset="${RETVAL}"
};
if [[ "${GVM_DEBUG}" -eq 1 ]]; then
echo "Resolved default go: ${defaults_go_name:-[EMPTY]}";
echo "Resolved default pkgset: ${defaults_go_pkgset:-[EMPTY]}";
fi;
__gvmp_find_closest_dot_go_version > /dev/null;
rslt=$?;
dot_go_version="${RETVAL}";
if [[ $rslt -eq 0 ]]; then
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "Found dot_go_version: ${dot_go_version}";
local use_goversion="";
__gvmp_read_dot_go_version "${dot_go_version}" > /dev/null;
use_goversion="${RETVAL}";
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "Switching to: ${use_goversion}";
\gvm use --quiet "${use_goversion}" || return 1;
unset use_goversion;
else
if [[ -n "${defaults_go_name}" ]]; then
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "No .go-version found. Using system or default go.";
\gvm use --quiet "${defaults_go_name}" || return 1;
else
if [[ "${GVM_DEBUG}" -eq 1 ]]; then
local installed_hash;
installed_hash=();
__gvm_find_installed "" "${GVM_ROOT}/gos" > /dev/null;
installed_hash=(${RETVAL});
local go_archive_path="$GVM_ROOT/archive/go";
echo "No fallback go version could be found.";
if [[ ${#installed_hash[@]} -eq 0 && ! -d "${go_archive_path}" ]]; then
__gvm_locale_text_for_key "go_install_prompt" > /dev/null;
__gvm_display_error "${RETVAL}";
return 1;
fi;
unset go_archive_path;
unset installed_hash;
fi;
return 0;
fi;
fi;
__gvmp_find_closest_dot_go_pkgset > /dev/null;
rslt=$?;
dot_go_pkgset="${RETVAL}";
if [[ $rslt -eq 0 ]]; then
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "Found .go-pkgset: ${dot_go_pkgset}";
local use_gopkgset="";
__gvmp_read_dot_go_pkgset "${dot_go_pkgset}" > /dev/null;
use_gopkgset="${RETVAL}";
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "Switching to: ${use_gopkgset}";
\gvm pkgset use --quiet "${use_gopkgset}" || return 1;
unset use_gopkgset;
else
if [[ -n "${defaults_go_pkgset}" ]]; then
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "No .go-pkgset found. Using system or default pkgset.";
\gvm pkgset use --quiet "${defaults_go_pkgset}" || return 1;
else
[[ "${GVM_DEBUG}" -eq 1 ]] && echo "No fallback pkgset could be found.";
fi;
fi;
return 0
}
command cd Google\ Drive/
确实有效,\cd Google\ Drive/
但没有。