What will happen when I a script file and save it when it’s still running, and will it print my needed results.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Let’s test it.
Create a script
test.sh:and execute it:
Notice that
bashcontinued reading the modified file. It maintains its current position in the file (in bytes) when the file changes.As a demonstration, the script
gives the output
Notice that it attempted to execute the random gibberish.
(This is Ubuntu 12.04. Behavior may vary with other shells.)