공백이 있는 경로를 만들었고 디렉터리를 변경하려고 하면 공백을 이스케이프 처리하거나 경로를 인용했음에도 불구하고 "매개 변수가 너무 많습니다"라는 오류 메시지가 나타납니다.
제가 수행한 테스트는 다음과 같습니다.
# creating a path with spaces in it
$mkdir -p "01.Silly Path/0.2 With Plenty of /0.3 spaces"
# Trying to cd
$cd 01.Silly\ Path/0.2\ With\ Plenty\ of\ /0.3\ spaces/
bash: cd: too many arguments
# Trying with sh
$sh
$ cd 01.Silly\ Path/0.2\ With\ Plenty\ of\ /0.3\ spaces/
$ pwd
/xxx/Documents/dev/01.Silly Path/0.2 With Plenty of /0.3 spaces
# Trying to create a file using the problematic path : it works
$echo "dummy file test" > 01.Silly\ Path/0.2\ With\ Plenty\ of\ /0.3\ spaces/dummy_file.t
$cat 01.Silly\ Path/0.2\ With\ Plenty\ of\ /0.3\ spaces/dummy_file.t
dummy file test
# But command cd fails
$cd 01.Silly\ Path/0.2\ With\ Plenty\ of\ /0.3\ spaces/
bash: cd: too many arguments
$bash --version
GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
lde@ldedebian ~/Documents/dev $
$
# Tried quoting instead of escaping : still having failure with bash
$( cd "01.Silly Path/0.2 With Plenty of /0.3 spaces/" ; pwd)
bash: cd: too many arguments
# But works fine in zsh and sh
$sh -c ' cd "01.Silly Path/0.2 With Plenty of /0.3 spaces/" ; pwd '
/home/xxx/Documents/dev/01.Silly Path/0.2 With Plenty of /0.3 spaces
$zsh -c ' cd "01.Silly Path/0.2 With Plenty of /0.3 spaces/" ; pwd '
/home/xxx/Documents/dev/01.Silly Path/0.2 With Plenty of /0.3 spaces
# And the issue seems to be related to spaces indeed
$mkdir -p "01.Silly_Path/0.2_With_Plenty_of_/0.3_spaces"
$( cd 01.Silly_Path/0.2_With_Plenty_of_/0.3_spaces/; pwd)
/home/xxx/Documents/dev/01.Silly_Path/0.2_With_Plenty_of_/0.3_spaces
Bash와 공간에 대해 제가 뭔가를 놓치고 있는 걸까요, 아니면 버그인가요?