For loop in Bash Script -
We say that we write a loop to use standard loop vocabulary that allows srm to place an item on your drive Loops to safely erase.
Now we say that we set it to repeat it 10 times, it is done after the first repetition, how can it still work on the file? File should no longer exist, so how can it erase? There is no question specific to SRM, anything can be run even like some MV, even if the file is no longer available.
This will run through loop 10 times, but except the first iteration, the commands you are executing He will fail (and 1 may return). This command will also write any error messages that usually write it (stdout, stderr or a file).
#! / Bin / bash for i {1..5} rm
Now, to handle a file named some
, you get:
rm: some: such a file or directory rm: some: no such file or directory rm: something: no such file or directory rm: something: There is no such file or directory:
Note that this is 4 times, not 5, because for the first time, rm
ran successfully.
Comments
Post a Comment