I wrote a shell script that uses cat and tr commands to generate a file. My shell script looks like #!/bin/bashprintf generating random file > plaintext \ncat -v | tr a-z b-y < plaintext  > generatedtext On executing the script, it doesn't terminate the cat command and when I've CTRL + Z to stop the shell script execution. Now, when I look into the contents of the generatedtext - the first character is altered(based on tr) and the rest of the characters are all one and the same as in the plaintext. For example, if the contents of plaintext This is an apple.After shell execution, the contents of generatedtext xhis is an apple.
How to terminate cat command within a shell script
shell script;cat;exit;tr
You need the tr after you read the plaintext file:#!/bin/bashprintf generating random file > plaintext \ncat -v < plaintext | tr a-z b-y > generatedtextIn your question plaintext is redirected to tr not cat. Alternatively, you can run the piped commands in a subshell:#!/bin/bashprintf generating random file > plaintext \n( cat -v | tr a-z b-y ) < plaintext  > generatedtext 