Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Usage :
- #
- # Just retreive file from pastebin :
- # 'pastebin.sh arg1 arg2'
- # arg1 : pastebin file ID
- # arg2 : destination file
- # example : 'pastebin.sh nL9DDqeT /usr/local/bin/pastebin.sh'
- #
- # Retreive script and set executable :
- # 'pastebin.sh arg1 arg2 arg3'
- # arg1 : '-x' to set executable
- # arg2 : pastebin file ID
- # arg3 : destination file
- # example : 'pastebin.sh -x nL9DDqeT /usr/local/bin/pastebin.sh'
- # Check if set file to be executable is wanted
- if [ $1 == "-x" ]; then
- # Delete first argument ('-x')
- shift 1
- # Store in a variable chmod command to execute later
- cmd="chmod +x $2"
- fi
- # Retreive script
- wget -qO- "http://pastebin.com/raw.php?i=$1" | tr -d '\r' > $2
- # If previously set, execute chmod command
- $cmd
Advertisement
Add Comment
Please, Sign In to add comment