How to repeat loop n times in Bash
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
5
down vote
favorite
I have below scenario like:
if [file exists]; then
exit
elif
recheck if file exist (max 10 times)
if found exit else recheck again as per counter
fi
any help would be helpful
bash shell-script
add a comment |Â
up vote
5
down vote
favorite
I have below scenario like:
if [file exists]; then
exit
elif
recheck if file exist (max 10 times)
if found exit else recheck again as per counter
fi
any help would be helpful
bash shell-script
This is a very basic feature in shells. Did you even research it?
â Peschke
yesterday
Yes. But not getting expected output from my code. Also want to write as abbreviated as possible
â Rocky86
yesterday
1
@Peschke, well, they'd need at least what, three basic features (loops, conditionals, testing the file, breaking out of a loop). At least the question is quite clear as it is. Though it could contain a sketch of what Rocky tried, but then someone would rewrite it full in the answers anyway. ;)
â ilkkachu
yesterday
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I have below scenario like:
if [file exists]; then
exit
elif
recheck if file exist (max 10 times)
if found exit else recheck again as per counter
fi
any help would be helpful
bash shell-script
I have below scenario like:
if [file exists]; then
exit
elif
recheck if file exist (max 10 times)
if found exit else recheck again as per counter
fi
any help would be helpful
bash shell-script
edited yesterday
ilkkachu
47.3k668130
47.3k668130
asked yesterday
Rocky86
647
647
This is a very basic feature in shells. Did you even research it?
â Peschke
yesterday
Yes. But not getting expected output from my code. Also want to write as abbreviated as possible
â Rocky86
yesterday
1
@Peschke, well, they'd need at least what, three basic features (loops, conditionals, testing the file, breaking out of a loop). At least the question is quite clear as it is. Though it could contain a sketch of what Rocky tried, but then someone would rewrite it full in the answers anyway. ;)
â ilkkachu
yesterday
add a comment |Â
This is a very basic feature in shells. Did you even research it?
â Peschke
yesterday
Yes. But not getting expected output from my code. Also want to write as abbreviated as possible
â Rocky86
yesterday
1
@Peschke, well, they'd need at least what, three basic features (loops, conditionals, testing the file, breaking out of a loop). At least the question is quite clear as it is. Though it could contain a sketch of what Rocky tried, but then someone would rewrite it full in the answers anyway. ;)
â ilkkachu
yesterday
This is a very basic feature in shells. Did you even research it?
â Peschke
yesterday
This is a very basic feature in shells. Did you even research it?
â Peschke
yesterday
Yes. But not getting expected output from my code. Also want to write as abbreviated as possible
â Rocky86
yesterday
Yes. But not getting expected output from my code. Also want to write as abbreviated as possible
â Rocky86
yesterday
1
1
@Peschke, well, they'd need at least what, three basic features (loops, conditionals, testing the file, breaking out of a loop). At least the question is quite clear as it is. Though it could contain a sketch of what Rocky tried, but then someone would rewrite it full in the answers anyway. ;)
â ilkkachu
yesterday
@Peschke, well, they'd need at least what, three basic features (loops, conditionals, testing the file, breaking out of a loop). At least the question is quite clear as it is. Though it could contain a sketch of what Rocky tried, but then someone would rewrite it full in the answers anyway. ;)
â ilkkachu
yesterday
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
0
down vote
accepted
n=0
until [ "$((n+=1))" -gt 10 ]
do <exists? command exit
done
echo oh noes!
though test -e file && exit
is more flexible
Why the question mark? Note that the behaviour for globs in the target of redirections varies between shells.
â Stéphane Chazelas
yesterday
2
Note that it has the side effect of opening the file, which for fifos for instance can be quite bad (worse with a symlink to /dev/watchdog on Linux for instance)
â Stéphane Chazelas
yesterday
Even in Bash, where this would look for a file likeexists1
or such, it still prints a bunch of errors if/when a matching file isn't found. (Also it errors if there are multiple matches.) Any other shell I tested seems to give errors in any case...
â ilkkachu
yesterday
@ikkachu - yeah. that was kinda the point. if the error happens, the script reports. if stderr should be suppressed, suppress itdone 2<>/dev/null
. doesbash
does that scripted? i thought it only effed that up in an-i
nteractive context. still,exists?
is as much as a filler name asfile
. but yeah, i hate quoting in redirects - if screws so much up.
â mikeserv
yesterday
@Stéphane - no reason, really. but yeah, fifos, unreadables... thats why i notedtest -e
.
â mikeserv
yesterday
 |Â
show 3 more comments
up vote
5
down vote
There are many ways to do this loop.
With ksh93
syntax (also supported by zsh
and bash
):
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
sleep 10
done
For any POSIX-like shell:
n=0
while [ "$n" -lt 10 ] && [ ! -e filename ]; do
n=$(( n + 1 ))
sleep 10
done
Both of the loops sleep 10 seconds in each iteration before testing the existence of the file again.
After the loop has finished, you will have to test for existence of the file a last time to figure out whether the loop exited due to running 10 times or due to the file appearing.
If you wish, and if you have access to inotify-tools, you may replace the sleep 10
call with
inotifywait -q -t 10 -e create ./ >/dev/null
This would wait for a file creation event to occur in the current directory, but would time out after 10 seconds. This way your loop would exit as soon as the given filename appeared (if it appeared).
The full code, with inotifywait
(replace with sleep 10
if you don't want that), may look like
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
inotifywait -q -t 10 -e create ./ >/dev/null
done
if [ -e filename ]; then
echo 'file appeared!'
else
echo 'file did not turn up in time'
fi
With inotify, you could almost replace the whole loop. Just test if the file is there, and if not, inotifywait for a 100 seconds. Almost, since the file could be created just between the test and the inotify, and you'd sleep for the full 100 seconds before timing out...
â ilkkachu
yesterday
1
@ilkkachu Yes, that's a good idea, but here I'm just usinginotifywait
as a drop-in replacement forsleep
.
â Kusalananda
yesterday
add a comment |Â
up vote
1
down vote
If the count is not a variable you can use brace expansion:
for i in 1..10 # you can also use 0..9
do
whatever
done
If the count is a variable you can use the seq
command:
count=10
for i in $(seq $count)
do
whatever
done
I want to loop only if file is not found (max. 10 times). If found lets say 3rd time then exit successfully
â Rocky86
yesterday
@Rocky86 : This does not contradict the solution proposed by xenoid. Nobody forces you to count until the end ....
â user1934428
14 hours ago
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
n=0
until [ "$((n+=1))" -gt 10 ]
do <exists? command exit
done
echo oh noes!
though test -e file && exit
is more flexible
Why the question mark? Note that the behaviour for globs in the target of redirections varies between shells.
â Stéphane Chazelas
yesterday
2
Note that it has the side effect of opening the file, which for fifos for instance can be quite bad (worse with a symlink to /dev/watchdog on Linux for instance)
â Stéphane Chazelas
yesterday
Even in Bash, where this would look for a file likeexists1
or such, it still prints a bunch of errors if/when a matching file isn't found. (Also it errors if there are multiple matches.) Any other shell I tested seems to give errors in any case...
â ilkkachu
yesterday
@ikkachu - yeah. that was kinda the point. if the error happens, the script reports. if stderr should be suppressed, suppress itdone 2<>/dev/null
. doesbash
does that scripted? i thought it only effed that up in an-i
nteractive context. still,exists?
is as much as a filler name asfile
. but yeah, i hate quoting in redirects - if screws so much up.
â mikeserv
yesterday
@Stéphane - no reason, really. but yeah, fifos, unreadables... thats why i notedtest -e
.
â mikeserv
yesterday
 |Â
show 3 more comments
up vote
0
down vote
accepted
n=0
until [ "$((n+=1))" -gt 10 ]
do <exists? command exit
done
echo oh noes!
though test -e file && exit
is more flexible
Why the question mark? Note that the behaviour for globs in the target of redirections varies between shells.
â Stéphane Chazelas
yesterday
2
Note that it has the side effect of opening the file, which for fifos for instance can be quite bad (worse with a symlink to /dev/watchdog on Linux for instance)
â Stéphane Chazelas
yesterday
Even in Bash, where this would look for a file likeexists1
or such, it still prints a bunch of errors if/when a matching file isn't found. (Also it errors if there are multiple matches.) Any other shell I tested seems to give errors in any case...
â ilkkachu
yesterday
@ikkachu - yeah. that was kinda the point. if the error happens, the script reports. if stderr should be suppressed, suppress itdone 2<>/dev/null
. doesbash
does that scripted? i thought it only effed that up in an-i
nteractive context. still,exists?
is as much as a filler name asfile
. but yeah, i hate quoting in redirects - if screws so much up.
â mikeserv
yesterday
@Stéphane - no reason, really. but yeah, fifos, unreadables... thats why i notedtest -e
.
â mikeserv
yesterday
 |Â
show 3 more comments
up vote
0
down vote
accepted
up vote
0
down vote
accepted
n=0
until [ "$((n+=1))" -gt 10 ]
do <exists? command exit
done
echo oh noes!
though test -e file && exit
is more flexible
n=0
until [ "$((n+=1))" -gt 10 ]
do <exists? command exit
done
echo oh noes!
though test -e file && exit
is more flexible
answered yesterday
mikeserv
44k564148
44k564148
Why the question mark? Note that the behaviour for globs in the target of redirections varies between shells.
â Stéphane Chazelas
yesterday
2
Note that it has the side effect of opening the file, which for fifos for instance can be quite bad (worse with a symlink to /dev/watchdog on Linux for instance)
â Stéphane Chazelas
yesterday
Even in Bash, where this would look for a file likeexists1
or such, it still prints a bunch of errors if/when a matching file isn't found. (Also it errors if there are multiple matches.) Any other shell I tested seems to give errors in any case...
â ilkkachu
yesterday
@ikkachu - yeah. that was kinda the point. if the error happens, the script reports. if stderr should be suppressed, suppress itdone 2<>/dev/null
. doesbash
does that scripted? i thought it only effed that up in an-i
nteractive context. still,exists?
is as much as a filler name asfile
. but yeah, i hate quoting in redirects - if screws so much up.
â mikeserv
yesterday
@Stéphane - no reason, really. but yeah, fifos, unreadables... thats why i notedtest -e
.
â mikeserv
yesterday
 |Â
show 3 more comments
Why the question mark? Note that the behaviour for globs in the target of redirections varies between shells.
â Stéphane Chazelas
yesterday
2
Note that it has the side effect of opening the file, which for fifos for instance can be quite bad (worse with a symlink to /dev/watchdog on Linux for instance)
â Stéphane Chazelas
yesterday
Even in Bash, where this would look for a file likeexists1
or such, it still prints a bunch of errors if/when a matching file isn't found. (Also it errors if there are multiple matches.) Any other shell I tested seems to give errors in any case...
â ilkkachu
yesterday
@ikkachu - yeah. that was kinda the point. if the error happens, the script reports. if stderr should be suppressed, suppress itdone 2<>/dev/null
. doesbash
does that scripted? i thought it only effed that up in an-i
nteractive context. still,exists?
is as much as a filler name asfile
. but yeah, i hate quoting in redirects - if screws so much up.
â mikeserv
yesterday
@Stéphane - no reason, really. but yeah, fifos, unreadables... thats why i notedtest -e
.
â mikeserv
yesterday
Why the question mark? Note that the behaviour for globs in the target of redirections varies between shells.
â Stéphane Chazelas
yesterday
Why the question mark? Note that the behaviour for globs in the target of redirections varies between shells.
â Stéphane Chazelas
yesterday
2
2
Note that it has the side effect of opening the file, which for fifos for instance can be quite bad (worse with a symlink to /dev/watchdog on Linux for instance)
â Stéphane Chazelas
yesterday
Note that it has the side effect of opening the file, which for fifos for instance can be quite bad (worse with a symlink to /dev/watchdog on Linux for instance)
â Stéphane Chazelas
yesterday
Even in Bash, where this would look for a file like
exists1
or such, it still prints a bunch of errors if/when a matching file isn't found. (Also it errors if there are multiple matches.) Any other shell I tested seems to give errors in any case...â ilkkachu
yesterday
Even in Bash, where this would look for a file like
exists1
or such, it still prints a bunch of errors if/when a matching file isn't found. (Also it errors if there are multiple matches.) Any other shell I tested seems to give errors in any case...â ilkkachu
yesterday
@ikkachu - yeah. that was kinda the point. if the error happens, the script reports. if stderr should be suppressed, suppress it
done 2<>/dev/null
. does bash
does that scripted? i thought it only effed that up in an -i
nteractive context. still, exists?
is as much as a filler name as file
. but yeah, i hate quoting in redirects - if screws so much up.â mikeserv
yesterday
@ikkachu - yeah. that was kinda the point. if the error happens, the script reports. if stderr should be suppressed, suppress it
done 2<>/dev/null
. does bash
does that scripted? i thought it only effed that up in an -i
nteractive context. still, exists?
is as much as a filler name as file
. but yeah, i hate quoting in redirects - if screws so much up.â mikeserv
yesterday
@Stéphane - no reason, really. but yeah, fifos, unreadables... thats why i noted
test -e
.â mikeserv
yesterday
@Stéphane - no reason, really. but yeah, fifos, unreadables... thats why i noted
test -e
.â mikeserv
yesterday
 |Â
show 3 more comments
up vote
5
down vote
There are many ways to do this loop.
With ksh93
syntax (also supported by zsh
and bash
):
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
sleep 10
done
For any POSIX-like shell:
n=0
while [ "$n" -lt 10 ] && [ ! -e filename ]; do
n=$(( n + 1 ))
sleep 10
done
Both of the loops sleep 10 seconds in each iteration before testing the existence of the file again.
After the loop has finished, you will have to test for existence of the file a last time to figure out whether the loop exited due to running 10 times or due to the file appearing.
If you wish, and if you have access to inotify-tools, you may replace the sleep 10
call with
inotifywait -q -t 10 -e create ./ >/dev/null
This would wait for a file creation event to occur in the current directory, but would time out after 10 seconds. This way your loop would exit as soon as the given filename appeared (if it appeared).
The full code, with inotifywait
(replace with sleep 10
if you don't want that), may look like
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
inotifywait -q -t 10 -e create ./ >/dev/null
done
if [ -e filename ]; then
echo 'file appeared!'
else
echo 'file did not turn up in time'
fi
With inotify, you could almost replace the whole loop. Just test if the file is there, and if not, inotifywait for a 100 seconds. Almost, since the file could be created just between the test and the inotify, and you'd sleep for the full 100 seconds before timing out...
â ilkkachu
yesterday
1
@ilkkachu Yes, that's a good idea, but here I'm just usinginotifywait
as a drop-in replacement forsleep
.
â Kusalananda
yesterday
add a comment |Â
up vote
5
down vote
There are many ways to do this loop.
With ksh93
syntax (also supported by zsh
and bash
):
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
sleep 10
done
For any POSIX-like shell:
n=0
while [ "$n" -lt 10 ] && [ ! -e filename ]; do
n=$(( n + 1 ))
sleep 10
done
Both of the loops sleep 10 seconds in each iteration before testing the existence of the file again.
After the loop has finished, you will have to test for existence of the file a last time to figure out whether the loop exited due to running 10 times or due to the file appearing.
If you wish, and if you have access to inotify-tools, you may replace the sleep 10
call with
inotifywait -q -t 10 -e create ./ >/dev/null
This would wait for a file creation event to occur in the current directory, but would time out after 10 seconds. This way your loop would exit as soon as the given filename appeared (if it appeared).
The full code, with inotifywait
(replace with sleep 10
if you don't want that), may look like
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
inotifywait -q -t 10 -e create ./ >/dev/null
done
if [ -e filename ]; then
echo 'file appeared!'
else
echo 'file did not turn up in time'
fi
With inotify, you could almost replace the whole loop. Just test if the file is there, and if not, inotifywait for a 100 seconds. Almost, since the file could be created just between the test and the inotify, and you'd sleep for the full 100 seconds before timing out...
â ilkkachu
yesterday
1
@ilkkachu Yes, that's a good idea, but here I'm just usinginotifywait
as a drop-in replacement forsleep
.
â Kusalananda
yesterday
add a comment |Â
up vote
5
down vote
up vote
5
down vote
There are many ways to do this loop.
With ksh93
syntax (also supported by zsh
and bash
):
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
sleep 10
done
For any POSIX-like shell:
n=0
while [ "$n" -lt 10 ] && [ ! -e filename ]; do
n=$(( n + 1 ))
sleep 10
done
Both of the loops sleep 10 seconds in each iteration before testing the existence of the file again.
After the loop has finished, you will have to test for existence of the file a last time to figure out whether the loop exited due to running 10 times or due to the file appearing.
If you wish, and if you have access to inotify-tools, you may replace the sleep 10
call with
inotifywait -q -t 10 -e create ./ >/dev/null
This would wait for a file creation event to occur in the current directory, but would time out after 10 seconds. This way your loop would exit as soon as the given filename appeared (if it appeared).
The full code, with inotifywait
(replace with sleep 10
if you don't want that), may look like
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
inotifywait -q -t 10 -e create ./ >/dev/null
done
if [ -e filename ]; then
echo 'file appeared!'
else
echo 'file did not turn up in time'
fi
There are many ways to do this loop.
With ksh93
syntax (also supported by zsh
and bash
):
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
sleep 10
done
For any POSIX-like shell:
n=0
while [ "$n" -lt 10 ] && [ ! -e filename ]; do
n=$(( n + 1 ))
sleep 10
done
Both of the loops sleep 10 seconds in each iteration before testing the existence of the file again.
After the loop has finished, you will have to test for existence of the file a last time to figure out whether the loop exited due to running 10 times or due to the file appearing.
If you wish, and if you have access to inotify-tools, you may replace the sleep 10
call with
inotifywait -q -t 10 -e create ./ >/dev/null
This would wait for a file creation event to occur in the current directory, but would time out after 10 seconds. This way your loop would exit as soon as the given filename appeared (if it appeared).
The full code, with inotifywait
(replace with sleep 10
if you don't want that), may look like
for (( i=0; i<10; ++i)); do
[ -e filename ] && break
inotifywait -q -t 10 -e create ./ >/dev/null
done
if [ -e filename ]; then
echo 'file appeared!'
else
echo 'file did not turn up in time'
fi
edited yesterday
answered yesterday
Kusalananda
100k13199311
100k13199311
With inotify, you could almost replace the whole loop. Just test if the file is there, and if not, inotifywait for a 100 seconds. Almost, since the file could be created just between the test and the inotify, and you'd sleep for the full 100 seconds before timing out...
â ilkkachu
yesterday
1
@ilkkachu Yes, that's a good idea, but here I'm just usinginotifywait
as a drop-in replacement forsleep
.
â Kusalananda
yesterday
add a comment |Â
With inotify, you could almost replace the whole loop. Just test if the file is there, and if not, inotifywait for a 100 seconds. Almost, since the file could be created just between the test and the inotify, and you'd sleep for the full 100 seconds before timing out...
â ilkkachu
yesterday
1
@ilkkachu Yes, that's a good idea, but here I'm just usinginotifywait
as a drop-in replacement forsleep
.
â Kusalananda
yesterday
With inotify, you could almost replace the whole loop. Just test if the file is there, and if not, inotifywait for a 100 seconds. Almost, since the file could be created just between the test and the inotify, and you'd sleep for the full 100 seconds before timing out...
â ilkkachu
yesterday
With inotify, you could almost replace the whole loop. Just test if the file is there, and if not, inotifywait for a 100 seconds. Almost, since the file could be created just between the test and the inotify, and you'd sleep for the full 100 seconds before timing out...
â ilkkachu
yesterday
1
1
@ilkkachu Yes, that's a good idea, but here I'm just using
inotifywait
as a drop-in replacement for sleep
.â Kusalananda
yesterday
@ilkkachu Yes, that's a good idea, but here I'm just using
inotifywait
as a drop-in replacement for sleep
.â Kusalananda
yesterday
add a comment |Â
up vote
1
down vote
If the count is not a variable you can use brace expansion:
for i in 1..10 # you can also use 0..9
do
whatever
done
If the count is a variable you can use the seq
command:
count=10
for i in $(seq $count)
do
whatever
done
I want to loop only if file is not found (max. 10 times). If found lets say 3rd time then exit successfully
â Rocky86
yesterday
@Rocky86 : This does not contradict the solution proposed by xenoid. Nobody forces you to count until the end ....
â user1934428
14 hours ago
add a comment |Â
up vote
1
down vote
If the count is not a variable you can use brace expansion:
for i in 1..10 # you can also use 0..9
do
whatever
done
If the count is a variable you can use the seq
command:
count=10
for i in $(seq $count)
do
whatever
done
I want to loop only if file is not found (max. 10 times). If found lets say 3rd time then exit successfully
â Rocky86
yesterday
@Rocky86 : This does not contradict the solution proposed by xenoid. Nobody forces you to count until the end ....
â user1934428
14 hours ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
If the count is not a variable you can use brace expansion:
for i in 1..10 # you can also use 0..9
do
whatever
done
If the count is a variable you can use the seq
command:
count=10
for i in $(seq $count)
do
whatever
done
If the count is not a variable you can use brace expansion:
for i in 1..10 # you can also use 0..9
do
whatever
done
If the count is a variable you can use the seq
command:
count=10
for i in $(seq $count)
do
whatever
done
answered yesterday
xenoid
1,6521620
1,6521620
I want to loop only if file is not found (max. 10 times). If found lets say 3rd time then exit successfully
â Rocky86
yesterday
@Rocky86 : This does not contradict the solution proposed by xenoid. Nobody forces you to count until the end ....
â user1934428
14 hours ago
add a comment |Â
I want to loop only if file is not found (max. 10 times). If found lets say 3rd time then exit successfully
â Rocky86
yesterday
@Rocky86 : This does not contradict the solution proposed by xenoid. Nobody forces you to count until the end ....
â user1934428
14 hours ago
I want to loop only if file is not found (max. 10 times). If found lets say 3rd time then exit successfully
â Rocky86
yesterday
I want to loop only if file is not found (max. 10 times). If found lets say 3rd time then exit successfully
â Rocky86
yesterday
@Rocky86 : This does not contradict the solution proposed by xenoid. Nobody forces you to count until the end ....
â user1934428
14 hours ago
@Rocky86 : This does not contradict the solution proposed by xenoid. Nobody forces you to count until the end ....
â user1934428
14 hours ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460595%2fhow-to-repeat-loop-n-times-in-bash%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
This is a very basic feature in shells. Did you even research it?
â Peschke
yesterday
Yes. But not getting expected output from my code. Also want to write as abbreviated as possible
â Rocky86
yesterday
1
@Peschke, well, they'd need at least what, three basic features (loops, conditionals, testing the file, breaking out of a loop). At least the question is quite clear as it is. Though it could contain a sketch of what Rocky tried, but then someone would rewrite it full in the answers anyway. ;)
â ilkkachu
yesterday