Advertisement
Sergio_Istea

backup-v5.sh

Oct 12th, 2022 (edited)
1,462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.30 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. declare -a arr
  4.  
  5. i=0
  6.  
  7.  
  8. for arg in $*; do
  9.  
  10.     arr[$i]=$arg
  11.     ((i++))
  12. done
  13.  
  14.  
  15. # backup.sh s /ruta/origen d /ruta/destino
  16.  
  17. if [ ${arr[0]} = d ]; then
  18.  
  19.     echo ${arr[1]}
  20.  
  21. elif [ ${arr[2]} = s ]; then
  22.  
  23.     echo ${arr[3]}
  24. else
  25.     echo "modo de uso: $0 s /ruta/origen d /ruta/destino"
  26. fi
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement