Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.66 KB | None | 0 0
  1. Just a proposal: to ease the script writing it could accept input from stdin.
  2. Your example could be more readable written in bash like this (uses bash heredoc syntax):
  3.  
  4. SESSION=$(vycli setupSession)
  5. vycli --session=$SESSION --read-stdin << EndOfFile
  6. configure
  7. set "system host-name vyos"
  8. delete "system name-server 192.0.2.1"
  9. commit
  10. exists "service dhcp-server"
  11. commit returnValue "system host-name"
  12. EndOfFile
  13.  
  14. vycli --session=$SESSION --format=json show "interfaces ethernet"
  15.  
  16. Also, you could save a file with the commands and do this:
  17.  
  18. vycli --session=$SESSION --read-stdin < myfile
  19. vycli --session=$SESSION --format=json show "interfaces ethernet"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement