Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

When I make a simple script, I get "Text File Busy" when I try to run it.

dbell@det-ui-supergbe:~$ cat > test2
ls
^Z
[2]+  Stopped                 cat > test2
dbell@det-ui-supergbe:~$ chmod a+x test2
dbell@det-ui-supergbe:~$ ./test2
-bash: ./test2: Text file busy
share|improve this question

1 Answer 1

up vote 6 down vote accepted

By hitting Ctrl-Z you suspended the cat, therefore the file is still open and being written to "in the background".

I suspect you want Ctrl-D for 'end of file'.

It's true that Ctrl-Z can mean 'EOF', but in this case, because you're in a terminal that supports background tasks, Ctrl-Z means 'suspend'.

Try this link for more information.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.