Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # requirements: sudo apt-get install sshpass zenity
- beep() {
- paplay /usr/share/sounds/KDE-Im-Irc-Event.ogg &
- }
- filename="$(zenity --file-selection)"
- # your final url, the filename will be added at the end (remember / at the end)
- prefix_url='https://website.co/'
- # server side upload location (remember / at the end)
- ssh_location='/var/www/img/'
- # server password
- ssh_pass='my_password'
- # server username
- ssh_user='admin'
- # server domain (no www/http etc)
- ssh_domain='website.co'
- # what to chmod the file to after upload
- ssh_chmod=777
- # self explanatory
- after_play_sound=true
- after_open_browser=true
- after_copy_to_clipboard=true
- escaped=$(printf %q "$ssh_location"$(basename "$filename"))
- sshpass -p $ssh_pass scp "$filename" $ssh_user@$ssh_domain:$ssh_location
- sshpass -p $ssh_pass ssh $ssh_user@$ssh_domain chmod -R $ssh_chmod "$escaped"
- url=$prefix_url$(basename "$filename")
- if [ "$after_copy_to_clipboard" = true ] ; then
- echo -n $url | xclip -selection c
- fi
- if [ "$after_play_sound" = true ] ; then
- beep
- fi
- if [ "$after_open_browser" = true ] ; then
- xdg-open "$url"
- fi
Add Comment
Please, Sign In to add comment