Last active
January 26, 2017 16:13
-
-
Save chriscorwin/1ad28403df7e5b4445e36264158fcd99 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| pbscript="/Users/ccorwin/Google Drive/Documents/pasteboard.sh" | |
| touch "${pbscript}" | |
| pbpaste > "${pbscript}" | |
| highlight -O rtf -t 2 -K 11 -k 'Source Code Pro' --syntax 'Bash' "${pbscript}" | pbcopy | |
| echo -n "Enter gist filename and press [ENTER]: " | |
| read gistfilename | |
| if [[ -n "${gistfilename/[ ]*\n/}" ]] | |
| then | |
| #execute if the the variable is not empty and contains non space characters | |
| echo "New filename is: ${gistfilename}"; | |
| gist --filename "${gistfilename}.sh" --open "${pbscript}" | |
| else | |
| echo "Using default (foo) filename."; | |
| #execute if the variable is empty or contains only spaces | |
| gist --type sh --open "${pbscript}" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment