-
-
Save sheedy/23523f041cceb799e7ec 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
#!/bin/bash | |
USER=YOUR_USERNAME | |
HOST=YOUR_SERVER_HOSTNAME | |
WEBPATH=PATH_TO_WEBSERVER_ROOT | |
WEBURL=YOUR_URL | |
BACKUP_DIR=DIR_FOR_BACKUP | |
file=$(mktemp $BACKUP_DIR/XXXXXX) | |
mv $file $file.html | |
file="$file.html" | |
chmod 644 ${file} | |
[[ ! -z "$1" ]] && lang="-s $1" | |
cat - > ${file}.in | |
source-highlight -i ${file}.in -o ${file} ${lang} | |
rm ${file}.in | |
scp -q -o "LogLevel quiet" ${file} $USER@$HOST:$WEBPATH | |
echo "http://$WEBURL/${file##*/}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment