Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. $ yes | ./script
  2.  
  3. $ yes n | ./script
  4.  
  5. $ printf 'ynynyn' | ./script
  6.  
  7. $ printf 'yesnnonmayben' | ./script
  8.  
  9. $ printf 'yyy' | ./script
  10.  
  11. $ ./script << EOF
  12. y
  13. y
  14. y
  15. EOF
  16.  
  17. $ ./script <<< "y
  18. y
  19. y
  20. "
  21.  
  22. $ ./script < inputfile
  23.  
  24. $ ./script < echo 'yyyyyyyyyyyyyy'
  25. bash: echo: No such file or directory
  26.  
  27. $ ./script 'yyyyyyyyyyyyyy' < echo
  28. bash: echo: No such file or directory
  29.  
  30. # Assume $remote_server, $my_user_id, $my_password, and $my_command were read in earlier
  31. # in the script.
  32. # Open a telnet session to a remote server, and wait for a username prompt.
  33. spawn telnet $remote_server
  34. expect "username:"
  35. # Send the username, and then wait for a password prompt.
  36. send "$my_user_idr"
  37. expect "password:"
  38. # Send the password, and then wait for a shell prompt.
  39. send "$my_passwordr"
  40. expect "%"
  41. # Send the prebuilt command, and then wait for another shell prompt.
  42. send "$my_commandr"
  43. expect "%"
  44. # Capture the results of the command into a variable. This can be displayed, or written to disk.
  45. set results $expect_out(buffer)
  46. # Exit the telnet session, and wait for a special end-of-file character.
  47. send "exitr"
  48. expect eof
  49.  
  50. spawn script.sh
  51. expect "Are you sure you want to continue connecting (yes/no)?"
  52. send "yes"
  53.  
  54. yes | script
  55.  
  56. NAME
  57. yes - output a string repeatedly until killed
  58.  
  59. SYNOPSIS
  60. yes [STRING]...
  61. yes OPTION
  62.  
  63. DESCRIPTION
  64. Repeatedly output a line with all specified STRING(s), or 'y'.
  65.  
  66. # -Wy force signaturewipe (if exists)
  67. echo "y" | sudo lvcreate -W y -n $lvName -L "$lvSize"G /dev/"$svg" >> $nfsUtilLog
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement