Skip to content

Instantly share code, notes, and snippets.

@inakagawa
Created February 22, 2017 07:13
Show Gist options
  • Save inakagawa/a0bc48e38c0c0ff32c7685f3968f113e to your computer and use it in GitHub Desktop.
Save inakagawa/a0bc48e38c0c0ff32c7685f3968f113e to your computer and use it in GitHub Desktop.
gistに投稿した後、アップデートするためのシェルスクリプトを同じdirに書き出す
# シェルスクリプト関数として .bashrc などに書いてもよい
function gist-here () {
if [ $# -ne 1 ]; then
echo 'gist_here [FILENAME]'
echo ' to post the file, clip its URL.'
exit 1
fi
url=`gist $1`
echo '#!/bin/bash' > gist-update.sh
echo "gist -u $url $1" >> gist-update.sh
echo "gist url: $url"
echo $url | pbcopy
}
@inakagawa
Copy link
Author

こういうことをしなくても、gistコマンドのオプションでどうにかなりそうな気はする

-p : private
-f [filename] :標準入力をこの名前で投稿
-d [description]
-c : copy url to clipboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment