Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. usage () {
  4. echo "Usage: $( basename $0 ) <e|d> <string>"
  5. }
  6.  
  7. if [ "$#" -lt 2 ]; then
  8. usage
  9. exit 1
  10. fi
  11.  
  12. if [ "$1" = "e" ]; then
  13. echo "$2" | ruby -ruri -ne 'puts URI.encode($_.chomp)'
  14. elif [ "$1" = "d" ]; then
  15. echo "$2" | ruby -ruri -ne 'puts URI.decode($_.chomp)'
  16. else
  17. usage
  18. exit 1
  19. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement