If that is true, if writes to the tasklist, if not, it writes to another list.
Since one can pass multiple arguments to touch, one can even use parameter expansion to create multiple files at once.
#!/bin/bash
DATA="$HOME/data"
LIST="$DATA/mylist.txt"
JOB_NO="$DATA/job_no.txt"
JOB_YES="$DATA/job_yes.txt"
[ -d "$DATA" ] || mkdir -p "$DATA"
touch $JOB_{NO,YES} $LIST
while read dirfolder
do [ -d "$dirfolder" ] && \
echo "$dirfolder" >> "$JOB_YES" || \
echo "$dirfolder" >> "$JOB_NO"
done<"$LIST"
Have fun
Keine Kommentare:
Kommentar veröffentlichen