M
M
Mikklosh2017-10-30 17:11:00
bash
Mikklosh, 2017-10-30 17:11:00

File existence loop?

Hello.
The following problem arose, we need a loop that will check for the presence of a file, if it exists, it will copy it to another directory, if it does not exist, it pauses, then re-checks its presence and so on until the file is created . As far as I understand it should be something like:

if [ -f имя.файла ]; 
then
  cp
else
 ???????
    fi

It's not clear what should be instead of ????
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2017-10-30
@Mikklosh

while [ ! -f имя.файла ]; do
  sleep время
done
cp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question