27.08.2015 Views

Advanced Bash−Scripting Guide

Advanced Bash-Scripting Guide - Nicku.org

Advanced Bash-Scripting Guide - Nicku.org

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Advanced</strong> <strong>Bash−Scripting</strong> <strong>Guide</strong><br />

#!/bin/bash<br />

# Example "ex72.sh" modified to use encrypted password.<br />

# Note that this is still somewhat insecure,<br />

#+ since the decrypted password is sent in the clear.<br />

# Use something like "ssh" if this is a concern.<br />

E_BADARGS=65<br />

if [ −z "$1" ]<br />

then<br />

echo "Usage: `basename $0` filename"<br />

exit $E_BADARGS<br />

fi<br />

Username=bozo<br />

# Change to suit.<br />

pword=/home/bozo/secret/password_encrypted.file<br />

# File containing encrypted password.<br />

Filename=`basename $1` # Strips pathname out of file name<br />

Server="XXX"<br />

Directory="YYY"<br />

# Change above to actual server name & directory.<br />

Password=`cruft

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!