'loop statement using while true bash
Need to look for 2 things, either one to be met, running in a loop. 1 - look for a file is TRUE (check for file exists - will be created manually / automatic in a directory) 2 - If the file did not arrive at a specific time, exit the loop statement.
#!/bin/bash
TIME=$(date +%H%M)
file="/temp/test/filetest.txt"
while true
do
if [[ -f $file ]]
then
echo "File did arrive safely"
exit 0
else
if [[ $TIME = 1700 ]]
then
echo "Time is done"
exit 1
fi
fi
done
The script should stay in a loop till either the file is created or the time has come.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
