bash: echo: write error: Interrupted system call
up vote
8
down vote
favorite
I want to generate a sorted list with all 8-digit numbers — from 00000000 to 99999999.
I typed in the shell:
f() {
while IFS="" read -r line; do
for i in {0..9}; do
echo "$line$i";
done;
done
}
echo | f | f | f | f | f | f | f | f | tee result.txt | wc -l
response is
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
99998890
Why have I got these three errors and malformed result.txt ?
I use
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
Debian GNU/Linux 9.6 (stretch)
Linux kernel: 4.19.0 #2 SMP Thu Nov 1 15:31:34 EET 2018 x86_64 GNU/Linux
bash
|
show 2 more comments
up vote
8
down vote
favorite
I want to generate a sorted list with all 8-digit numbers — from 00000000 to 99999999.
I typed in the shell:
f() {
while IFS="" read -r line; do
for i in {0..9}; do
echo "$line$i";
done;
done
}
echo | f | f | f | f | f | f | f | f | tee result.txt | wc -l
response is
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
99998890
Why have I got these three errors and malformed result.txt ?
I use
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
Debian GNU/Linux 9.6 (stretch)
Linux kernel: 4.19.0 #2 SMP Thu Nov 1 15:31:34 EET 2018 x86_64 GNU/Linux
bash
I can't help but feeling this way of doing it would not be more efficient thanseq -w 0 99999999.
– Kusalananda
8 hours ago
1
Then the question is incomplete/incorrect/badly written or something else. Because the script (when completed with the}) works correctly. @GAD3R
– Isaac
8 hours ago
1
Note: I can trigger these errors almost on demand. They often appear when I resize mykonsolewindow. Such resizing is almost sufficient in my case, yet not necessary.
– Kamil Maciorowski
8 hours ago
I can remove the| tee result.txt, and still get the error.
– ctrl-alt-delor
6 hours ago
Another note: external executable (/bin/echoin my case) instead ofechobuiltin makes the function immune (or at least less prone) to this issue.
– Kamil Maciorowski
2 hours ago
|
show 2 more comments
up vote
8
down vote
favorite
up vote
8
down vote
favorite
I want to generate a sorted list with all 8-digit numbers — from 00000000 to 99999999.
I typed in the shell:
f() {
while IFS="" read -r line; do
for i in {0..9}; do
echo "$line$i";
done;
done
}
echo | f | f | f | f | f | f | f | f | tee result.txt | wc -l
response is
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
99998890
Why have I got these three errors and malformed result.txt ?
I use
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
Debian GNU/Linux 9.6 (stretch)
Linux kernel: 4.19.0 #2 SMP Thu Nov 1 15:31:34 EET 2018 x86_64 GNU/Linux
bash
I want to generate a sorted list with all 8-digit numbers — from 00000000 to 99999999.
I typed in the shell:
f() {
while IFS="" read -r line; do
for i in {0..9}; do
echo "$line$i";
done;
done
}
echo | f | f | f | f | f | f | f | f | tee result.txt | wc -l
response is
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
bash: echo: write error: Interrupted system call
99998890
Why have I got these three errors and malformed result.txt ?
I use
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
Debian GNU/Linux 9.6 (stretch)
Linux kernel: 4.19.0 #2 SMP Thu Nov 1 15:31:34 EET 2018 x86_64 GNU/Linux
bash
bash
edited 6 hours ago
ctrl-alt-delor
10.4k41955
10.4k41955
asked 9 hours ago
hon
895
895
I can't help but feeling this way of doing it would not be more efficient thanseq -w 0 99999999.
– Kusalananda
8 hours ago
1
Then the question is incomplete/incorrect/badly written or something else. Because the script (when completed with the}) works correctly. @GAD3R
– Isaac
8 hours ago
1
Note: I can trigger these errors almost on demand. They often appear when I resize mykonsolewindow. Such resizing is almost sufficient in my case, yet not necessary.
– Kamil Maciorowski
8 hours ago
I can remove the| tee result.txt, and still get the error.
– ctrl-alt-delor
6 hours ago
Another note: external executable (/bin/echoin my case) instead ofechobuiltin makes the function immune (or at least less prone) to this issue.
– Kamil Maciorowski
2 hours ago
|
show 2 more comments
I can't help but feeling this way of doing it would not be more efficient thanseq -w 0 99999999.
– Kusalananda
8 hours ago
1
Then the question is incomplete/incorrect/badly written or something else. Because the script (when completed with the}) works correctly. @GAD3R
– Isaac
8 hours ago
1
Note: I can trigger these errors almost on demand. They often appear when I resize mykonsolewindow. Such resizing is almost sufficient in my case, yet not necessary.
– Kamil Maciorowski
8 hours ago
I can remove the| tee result.txt, and still get the error.
– ctrl-alt-delor
6 hours ago
Another note: external executable (/bin/echoin my case) instead ofechobuiltin makes the function immune (or at least less prone) to this issue.
– Kamil Maciorowski
2 hours ago
I can't help but feeling this way of doing it would not be more efficient than
seq -w 0 99999999.– Kusalananda
8 hours ago
I can't help but feeling this way of doing it would not be more efficient than
seq -w 0 99999999.– Kusalananda
8 hours ago
1
1
Then the question is incomplete/incorrect/badly written or something else. Because the script (when completed with the
}) works correctly. @GAD3R– Isaac
8 hours ago
Then the question is incomplete/incorrect/badly written or something else. Because the script (when completed with the
}) works correctly. @GAD3R– Isaac
8 hours ago
1
1
Note: I can trigger these errors almost on demand. They often appear when I resize my
konsole window. Such resizing is almost sufficient in my case, yet not necessary.– Kamil Maciorowski
8 hours ago
Note: I can trigger these errors almost on demand. They often appear when I resize my
konsole window. Such resizing is almost sufficient in my case, yet not necessary.– Kamil Maciorowski
8 hours ago
I can remove the
| tee result.txt, and still get the error.– ctrl-alt-delor
6 hours ago
I can remove the
| tee result.txt, and still get the error.– ctrl-alt-delor
6 hours ago
Another note: external executable (
/bin/echo in my case) instead of echo builtin makes the function immune (or at least less prone) to this issue.– Kamil Maciorowski
2 hours ago
Another note: external executable (
/bin/echo in my case) instead of echo builtin makes the function immune (or at least less prone) to this issue.– Kamil Maciorowski
2 hours ago
|
show 2 more comments
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
The specific write error: Interrupted system call error is generated when the console window size is changed while the script is being executed.
Doing a:
trap '' SIGWINCH
will avoid it.
Note that a
seq 99999999 >result.txt; wc -l <result.txt
Will be both faster and will avoid the SIGWINCH issua.
5
So what is going on?, why have I not seen this before?, Why is a write error, the correct thing to do?
– ctrl-alt-delor
6 hours ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
The specific write error: Interrupted system call error is generated when the console window size is changed while the script is being executed.
Doing a:
trap '' SIGWINCH
will avoid it.
Note that a
seq 99999999 >result.txt; wc -l <result.txt
Will be both faster and will avoid the SIGWINCH issua.
5
So what is going on?, why have I not seen this before?, Why is a write error, the correct thing to do?
– ctrl-alt-delor
6 hours ago
add a comment |
up vote
5
down vote
accepted
The specific write error: Interrupted system call error is generated when the console window size is changed while the script is being executed.
Doing a:
trap '' SIGWINCH
will avoid it.
Note that a
seq 99999999 >result.txt; wc -l <result.txt
Will be both faster and will avoid the SIGWINCH issua.
5
So what is going on?, why have I not seen this before?, Why is a write error, the correct thing to do?
– ctrl-alt-delor
6 hours ago
add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
The specific write error: Interrupted system call error is generated when the console window size is changed while the script is being executed.
Doing a:
trap '' SIGWINCH
will avoid it.
Note that a
seq 99999999 >result.txt; wc -l <result.txt
Will be both faster and will avoid the SIGWINCH issua.
The specific write error: Interrupted system call error is generated when the console window size is changed while the script is being executed.
Doing a:
trap '' SIGWINCH
will avoid it.
Note that a
seq 99999999 >result.txt; wc -l <result.txt
Will be both faster and will avoid the SIGWINCH issua.
edited 5 hours ago
answered 7 hours ago
Isaac
10.8k11447
10.8k11447
5
So what is going on?, why have I not seen this before?, Why is a write error, the correct thing to do?
– ctrl-alt-delor
6 hours ago
add a comment |
5
So what is going on?, why have I not seen this before?, Why is a write error, the correct thing to do?
– ctrl-alt-delor
6 hours ago
5
5
So what is going on?, why have I not seen this before?, Why is a write error, the correct thing to do?
– ctrl-alt-delor
6 hours ago
So what is going on?, why have I not seen this before?, Why is a write error, the correct thing to do?
– ctrl-alt-delor
6 hours ago
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f486908%2fbash-echo-write-error-interrupted-system-call%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I can't help but feeling this way of doing it would not be more efficient than
seq -w 0 99999999.– Kusalananda
8 hours ago
1
Then the question is incomplete/incorrect/badly written or something else. Because the script (when completed with the
}) works correctly. @GAD3R– Isaac
8 hours ago
1
Note: I can trigger these errors almost on demand. They often appear when I resize my
konsolewindow. Such resizing is almost sufficient in my case, yet not necessary.– Kamil Maciorowski
8 hours ago
I can remove the
| tee result.txt, and still get the error.– ctrl-alt-delor
6 hours ago
Another note: external executable (
/bin/echoin my case) instead ofechobuiltin makes the function immune (or at least less prone) to this issue.– Kamil Maciorowski
2 hours ago