Linux cycle?

what is the meaning of $@ & & return described in the book?

Code block:

repeat()
{
  while true
  do
  $@ && return
  done
  }

Apr.25,2022

first look at the use of & &
command1 & command2
& & the command on the left (command1) returns true (that is, 0 is successfully executed) before the command on the right (command2) can be executed;
in other words, "if the command is executed successfully & then execute the command".

look at $@ & & return
return function is to end the loop
and $@ is all the parameters passed to the script
for example, if you want to execute wget url
, it becomes wget url & retrun
so when wget url successfully returns 0, execute return end the loop

Menu