Bash 스마트 완료 방지 및 확장 무시

Bash 스마트 완료 방지 및 확장 무시

bash에서 bar.dat 압축 풀기를 완료할 수 없는 이유 - 파일은 현재 디렉터리에 있습니다. bash는 파일 확장자를 읽고 도움을 주려고 합니까?

[a@localhost:~/tmp]$ echo "Hello World" > foo.txt
[a@localhost:~/tmp]$ zip bar.dat foo.txt
  adding: foo.txt (stored 0%)
[a@localhost:~/tmp]$ unzip bar.dat   <---- won't complete bar.dat
Archive:  bar.dat
replace foo.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: n
[a@localhost:~/tmp]$ file bar.dat
bar.dat: Zip archive data, at least v1.0 to extract

답변1

이는 bash완료 기능을 통해 _install_xspec수행 됩니다. 로컬 설정은 다를 수 있지만 일반적으로 다양한 파일 확장자 완성은 _xspecs배열에 의해 제어됩니다. 이 작업을 수행:

$ set | grep _xspecs

로 시작하는 거대한 텍스트 벽을 볼 수 있습니다 _xspecs=(. 다음에 대한 섹션도 있습니다 unzip.

[unzip]="!*.@(zip|[ejsw]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|epub|apk|do[ct][xm]|p[op]t[mx]|xl[st][xm])"

dat보시다시피 이 목록에는 없습니다.

관련 정보