Why does âcat myfile >> myfileâ cause infinite loop?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Why does cat myfile >> myfile cause an infinite loop forcing me to kill the process?
my understanding is that this commandcat myfile >> myfile should simply do the following
- Read myfile and send file contents to stdout
- Redirect the contents of stdout and append to myfile
I would expect this to result in the contents of myfile to contain two copies of the original contents, appended together.
bash cat stdout
New contributor
James Wierzba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
favorite
Why does cat myfile >> myfile cause an infinite loop forcing me to kill the process?
my understanding is that this commandcat myfile >> myfile should simply do the following
- Read myfile and send file contents to stdout
- Redirect the contents of stdout and append to myfile
I would expect this to result in the contents of myfile to contain two copies of the original contents, appended together.
bash cat stdout
New contributor
James Wierzba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Possible duplicate of Why does cat x >> x loop?
â don_crissti
37 secs ago
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Why does cat myfile >> myfile cause an infinite loop forcing me to kill the process?
my understanding is that this commandcat myfile >> myfile should simply do the following
- Read myfile and send file contents to stdout
- Redirect the contents of stdout and append to myfile
I would expect this to result in the contents of myfile to contain two copies of the original contents, appended together.
bash cat stdout
New contributor
James Wierzba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Why does cat myfile >> myfile cause an infinite loop forcing me to kill the process?
my understanding is that this commandcat myfile >> myfile should simply do the following
- Read myfile and send file contents to stdout
- Redirect the contents of stdout and append to myfile
I would expect this to result in the contents of myfile to contain two copies of the original contents, appended together.
bash cat stdout
bash cat stdout
New contributor
James Wierzba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
James Wierzba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 25 secs ago
Rui F Ribeiro
37.1k1274118
37.1k1274118
New contributor
James Wierzba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 mins ago
James Wierzba
1012
1012
New contributor
James Wierzba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
James Wierzba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
James Wierzba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Possible duplicate of Why does cat x >> x loop?
â don_crissti
37 secs ago
add a comment |Â
Possible duplicate of Why does cat x >> x loop?
â don_crissti
37 secs ago
Possible duplicate of Why does cat x >> x loop?
â don_crissti
37 secs ago
Possible duplicate of Why does cat x >> x loop?
â don_crissti
37 secs ago
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
James Wierzba is a new contributor. Be nice, and check out our Code of Conduct.
James Wierzba is a new contributor. Be nice, and check out our Code of Conduct.
James Wierzba is a new contributor. Be nice, and check out our Code of Conduct.
James Wierzba is a new contributor. Be nice, and check out our Code of Conduct.
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%2f475889%2fwhy-does-cat-myfile-myfile-cause-infinite-loop%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
Possible duplicate of Why does cat x >> x loop?
â don_crissti
37 secs ago