Quantcast
Channel: while read line in shell script - how to stop the loop? - Unix & Linux Stack Exchange
Browsing all 4 articles
Browse latest View live

Answer by mikeserv for while read line in shell script - how to stop the loop?

line=\ ; PS4='${#line}: + ' while read line <&$((${#line}?0:3)) do : "$line" done <<msg 3</dev/null one nice thing about allowing shell expansions to self test is that the shell...

View Article



Answer by PSkocik for while read line in shell script - how to stop the loop?

while read line && [ "$line" != "quit" ]; do # ... Or to stop at an empty line: while read line && [ "$line" != "" ]; do # ... or while read line && [ -n "$line" ]; do # ... On...

View Article

Answer by Bruce Ediger for while read line in shell script - how to stop the...

Here's how you'd have the while-loop stop on a zero-length value of line: #!/usr/bin/bash while read line do if [[ -z $line ]] then exit fi wget -x "http://someurl.com/${line}.pdf" done < inputfile...

View Article

while read line in shell script - how to stop the loop?

I read a tutorial here that I can use while read line do wget -x "http://someurl.com/${line}.pdf" -o ${line}.pdf done < inputfile However this script keeps running with $line not containing any...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images