명령에 완전한 문자열로 줄을 입력하는 방법

명령에 완전한 문자열로 줄을 입력하는 방법

공백이 포함된 파일이 포함된 디렉터리

$ ls .
'File A'  'File B'  'File C'

$ walk .
.
./File A
./File B
./File C

ls는 각 공간을 새 파일로 해석합니다.

$ ls -ld $(walk .)
ls: cannot access './File': No such file or directory
ls: cannot access 'A': No such file or directory
ls: cannot access './File': No such file or directory
ls: cannot access 'B': No such file or directory
ls: cannot access './File': No such file or directory
ls: cannot access 'C': No such file or directory
drwxr-xr-x 1 nathan users 36 Apr 27 16:56 .
[ble: exit 2]

줄 주위에 따옴표 넣기

$ walk . | sed 's/.*/"&"/'
"."
"./File A"
"./File B"
"./File C"

작동하지 않습니다

$ ls -ld $(walk . | sed 's/.*/"&"/')
ls: cannot access '"."': No such file or directory
ls: cannot access '"./File': No such file or directory
ls: cannot access 'A"': No such file or directory
ls: cannot access '"./File': No such file or directory
ls: cannot access 'B"': No such file or directory
ls: cannot access '"./File': No such file or directory
ls: cannot access 'C"': No such file or directory
[ble: exit 2]

관련 정보