11.04.2013 Views

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appen<strong>di</strong>ce A. Script aggiuntivi<br />

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<br />

# Another variable.<br />

# This one may or may not be subject to variation.<br />

# A bit like the small print.<br />

CookiesON=$Cookie<br />

# echo "cookie file is $CookiesON" # For debugging.<br />

# echo "home is ${home}" # For debugging. Got caught with this one!<br />

wopts()<br />

{<br />

echo "Enter options to pass to wget."<br />

echo "It is assumed you know what you’re doing."<br />

echo<br />

echo "You can pass their arguments here too."<br />

# That is to say, everything passed here is passed to wget.<br />

read Wopts<br />

# Read in the options to be passed to wget.<br />

Woptions=" $Wopts"<br />

# Assign to another variable.<br />

# Just for fun, or something . . .<br />

echo "passing options ${Wopts} to wget"<br />

# Mainly for debugging.<br />

# Is cute.<br />

return<br />

}<br />

save_func()<br />

{<br />

echo "Settings will be saved."<br />

if [ ! -d $savePath ]; then # See if <strong>di</strong>rectory exists.<br />

mk<strong>di</strong>r $savePath # Create the <strong>di</strong>rectory to save things in<br />

#+ if it isn’t already there.<br />

fi<br />

Flag=S<br />

# Tell the final bit of code what to do.<br />

# Set a flag since stuff is done in main.<br />

return<br />

}<br />

usage() # Tell them how it works.<br />

{<br />

720

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

Saved successfully!

Ooh no, something went wrong!