C
C
csergey2014-04-02 10:14:48
linux
csergey, 2014-04-02 10:14:48

How to write the simplest loop in bash?

I know that it's easy, but it's urgent (and in general, 0 in programming).
We need a script that will execute the script.sh script twice, even if it fails the first time.
Or a script that will be executed again if the first time there was an error.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
tmin10, 2014-04-02
@tmin10

can run like this will be easier: ./script || ./script?

S
Sergey, 2014-04-02
@bk0011m

Why then cycle?
Isn't it easier to write the same thing twice?
#!/bin/sh
./script.sh
./script.sh
Or with error checking
#!/bin/sh
if ./script.sh
then echo NO ERROR
else ./script.sh
fi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question