Advertisement
sergio_educacionit

concatenacion condicial and

Dec 12th, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.43 KB | None | 0 0
  1. gw=$(ip route | head -1 | cut -d " " -f 3)
  2.  
  3. dir=files
  4.  
  5. # antes de ejecutarse las intrucciones principales (copiar el contenido de el
  6. # directorio files a un host remoto) se evalua si exite e ldirectorio files
  7. # y el host esta en red y hay gateway definido.
  8. #
  9.  
  10. if [ "$gw" == "192.168.0.1" ] && [ -d $dir ]; then
  11.  
  12.        
  13.     echo "scp -r files user@hostname:/files"
  14.     exit 0
  15.  
  16. fi
  17.  
  18.  
  19. echo "No se cunmplen los requisitos"
  20. exit 1
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement