bash - placements of an error message in while loop with conditional statements -
This script checks for 5 seconds every 5 seconds for the file's existence. The script waits for the file to appear if it gets the file because it "info: waiting"
If I can not find it, then with the error message it exits after 30 seconds If the file is not found.
The way the script is configured, error timeout is now printed after each error. <$ P> If I place it out of the loop - it does a great job This is what I am getting However if I touch the /tmp/2007.txt file - it breaks but error timeout still appears this is a simple question but I It is bringing it here in the community because it shows a common problem which I want to loop with the conditional statement. Keep in understanding where those statements. I have filled this lot in my script and I need to understand it, I need to develop. I'm looking for script for all 30 seconds to check, and if nothing has been found to get the error message out. If the script finds the file, then I should know that to remove the error message and not. #! / Bin / bash count = 1 while [$ count -le 6], then [! -e / TTP / 297 Tiaksteepi] again "Note: 5 Sleeping for seconds" ((count ++)) sleep 5 Alsf [-e /tmp/2007.txt] echo "information awaits" break fi echo "ERROR: 5 Sleeping for seconds: Timeout information: Sleeping for 5 seconds Error: Timeout information: Sleeping for 5 seconds Error: Timeout information: Sleeping for 5 seconds Error: Timeout information: For 5 seconds Sleeping error: Timeout information: Sleeping for 5 seconds Ruti: timeout
brake foot echo "ERROR: Timeout"
casper_mint @ casper-mint-dell ~ $ / Tmp / wait_while information: sleeping for 5 seconds info: sleeping for 5 seconds info: full wait error: timeout
You can check later whether went found files before displaying an error message, or when loop . / P>
#! / Bin / bash found = 0 count = 1 while [$ count -le 6] do that if [! -e /tmp/2007.txt] Then "Notification: Sleeping for 5 seconds" (count ++)) echo 5 and then found "Waiting for Wait:" = 1 = Break! $ Found] then repeat "error: timeout" file
Comments
Post a Comment