내 스크립트배쉬 문자 일치
#!/bin/bash
shopt -s extglob
for i in *.dat;
do
if [[ "$i" == *(_TEx) ]];then
file1=$i
fi
done
echo file1="$file1"
나는
262_V01_C00_R000_TEx_BL_2048H.dat
262_V01_C01_R000_TEy_BL_2048H.dat
262_V01_C02_R000_THx_BL_2048H.dat
262_V01_C03_R000_THy_BL_2048H.dat
그러나
[email protected]:~/procmt$ bash a8.sh
file1=
,536,913 파일
http://www.shellcheck.net/
$ shellcheck myscript
No issues detected!
와 스크립트를 테스트 한
왜?
이것은이 패턴과 일치하는 파일이 없음을 의미합니다. – fedorqui
@JohnKugelman 제 편집을 살펴보면 4 개의 파일이 있고 하나는 두 조건을 모두 충족합니다. –