[英]Bash scripting - using if in a for loop
這是我最后想出的答案
#!/bin/bash
>oldFiles.txt
files=$(grep ' jane ' ../data/list.txt | cut -d ' ' -f 3)
for x in $files;
do
if test -e ../data/$x; then echo $x >> oldFiles.txt; else echo $x; fi;
done
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.