Advertisement
sergio_educacionit

continue.sh

Feb 12th, 2025
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. mi_array=("uno" "dos" "tres" "cuatro")
  4.  
  5. for elemento in "${mi_array[@]}"; do
  6.  
  7.     if [[ "$elemento" == "tres" ]]; then
  8.     # al ejecutarse 'continue' se pasa a la siguente
  9.     # iteracion ignorando el codigo que viene despues
  10.         continue
  11.     fi
  12.     # si continue se ejecuta este codigo es ignorado
  13.     echo "Elemento: $elemento"
  14. done
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement