touch cat 명령어를 사용하면 파일을 만들 수 있다.
touch db.txt 를 만들고 데이터를 붙여넣은 다음,
read.sh을 만들어서
#! bin/bash
while read db; do
# if [ -z "$db" ]; then continue; fi
# echo "$db"
#done < data.txt
#if [[ -e $db ]]; then
# echo "FIle Exists"
#fi
#file = "/Vdrive/archive2020/item/2021/11/정사각형1(0).jpg"
if [[ ! -e $db ]]; then
echo $db " File Does not Exists"
fi
done < db.txt
넣었다.
처음에는 db.txt의 글을 한줄씩 읽는 것으로 짰고,
그다음 한줄씩 파일을 찾는 것으로 짰다.
while read db; do
- db는 변수다.
done < db.text
- 끝맺음을 하고, 읽을 파일을 연결한다.
-e 명령어로 파일을 찾고 !를 붙여서 없는 파일을 찾는 코드를 짠다.
echo $db " File Does not Exists"
- while read db; do 에서 만든 변수 $db를 넣어 db.txt의 한줄을 가져오고 " File Does not Exists" 글귀를 추가한다.
Linux MySQL 명령어 등 (0) | 2022.06.07 |
---|