Guest User

Untitled

a guest
Oct 25th, 2017
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. service='api.sys.us-east.big.co'
  2. username='adam.admin@big.co'
  3.  
  4. #get the password from the keychain
  5. password=$(security find-generic-password -ga "$username" -w)
  6.  
  7. #if the security command does not run sucessfully, prompt
  8. if [ $? -gt 0 ]; then
  9. echo "Please enter the password for '$username' on '$service': "
  10. echo -n "Password: "
  11. stty -echo
  12. read password
  13. stty echo
  14. security add-generic-password -U -a "$username" -s "$service" -w "$password"
  15. fi
  16.  
  17. export CF_API="$service"
  18. export CF_USER="$username"
  19. export CF_PASS="$password"
Add Comment
Please, Sign In to add comment