Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # Verkürze die übergebene URL mit Hilfe eines Scripts
- # und "speichere" die Short URL in der Zwischenablage
- # Short URL Script
- shorl="$HOME/bin/is.gd"
- shorl="$HOME/bin/x.co"
- # Holen:
- # xclip -out -selection clipboard
- # Setzen:
- # echo foo | xclip -in -selection clipboard
- # Welche X Clipboard Selection soll bearbeitet werden?
- # Werte: "primary", "secondary", "clipboard" or "buffer-cut"
- selection="clipboard"
- # Wurde Text auf der Kommandozeile uebergeben?
- if [[ "$#" -eq 0 ]]; then
- # Hole Text aus der Zwischenablage
- clip=$( xclip -out -selection $selection )
- else
- # Text von der Kommandozeile nehmen
- clip="$@"
- fi
- # Rufe Short URL Script auf und "speichere" Short URL im Clipboard
- short=$( "$shorl" "$clip" )
- printf '%s' "$short" | xclip -in -selection $selection
- printf "%s\n" "$short"
- notifyme.sh "URL gekürzt" "URL $clip zu $short gekürzt"
- exit $?
- # EOF #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement