Last active
January 26, 2017 16:16
-
-
Save chriscorwin/498ca6eaabdf135e1b57d45551efad9b 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.js" | |
| touch "${pbscript}" | |
| pbpaste > "${pbscript}" | |
| highlight -O rtf -t 2 -K 11 -k 'Source Code Pro' --syntax 'js' "${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}.js" --open "${pbscript}" | |
| else | |
| echo "Using default (foo) filename."; | |
| #execute if the variable is empty or contains only spaces | |
| gist --type js --open "${pbscript}" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment