Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
1 answer
97 views

Difference in `< <(cat file)` and `<file` feeding loop

I saw the following example for reading a file in a bash script: while read IP; do ${IPTABLES} -I INPUT -s "${IP}" -j DROP done < <(cat "${BLACKLIST}") but I'd have thought to do the ...
Still.Tony's user avatar
  • 1,435
3 votes
2 answers
3k views

Bash's cat, while, let and pipe lead to strange scoping behavior

So here's my script : count=0 cat myfile | while read line do #some stuff... let count++ echo $count done echo $count The last echo statement output 0 instead of the number of lines in ...
subb's user avatar
  • 1,568