Created
May 29, 2012 15:29
-
-
Save ralphbean/2829079 to your computer and use it in GitHub Desktop.
Script to upload little stdout blurbs.
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
| #!/bin/bash | |
| # Script to take the output of commands and post them to a tmp web directory | |
| # for easy sharing. Requires python-ansi2html. | |
| # | |
| # Author: Ralph Bean <[email protected]> | |
| # License: GPLv3+ | |
| # Edit the following three variables to suit your needs | |
| WEB_USER=your_username | |
| WEB_HOST=your_site.org | |
| WEB_DIR=~/public_html | |
| # ~/public_html/tmp needs to already exist on $WEB_HOST | |
| echo "Creating file" | |
| outfile=$(mktemp --suffix=.html) | |
| ansi2html < /dev/stdin > $outfile | |
| chmod o+r $outfile | |
| echo "Uploading $outfile" | |
| scp $outfile $WEB_USER@$WEB_HOST:$WEB_DIR$outfile | |
| echo "Removing $outfile" | |
| rm $outfile | |
| echo | |
| echo http://$WEB_HOST$outfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment