I’m working on a shell script that does certain changes on a txt file only if it does exist, however this test loop doesn’t work, I wonder why?
Thank you!
while [ ! -f /tmp/list.txt ] ;
do
sleep 2
done
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.
When you say “doesn’t work”, how do you know it doesn’t work?
You might try to figure out if the file actually exists by adding:
You might also make sure that you’re using a Bash (or related) shell by typing ‘echo $SHELL’. I think that CSH and TCSH use a slightly different semantic for this loop.