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.

}<br />

"<br />

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

$ cd -r Go to history entry 0 and put it on special entry 0<br />

if ${TEST} "$CD_MODE" = "PREV"<br />

then<br />

${PRINTF} "$cd_mnset"<br />

else<br />

${PRINTF} "$cd_mset"<br />

fi<br />

cd_Hm ()<br />

{<br />

cd_hm<br />

${PRINTF} "%s" "<br />

The previous <strong>di</strong>rectories (0-$cd_maxhistory) are stored in the<br />

environment variables CD[0] - CD[$cd_maxhistory]<br />

Similarly the special <strong>di</strong>rectories S0 - $cd_maxspecial are in<br />

the environment variable CDS[0] - CDS[$cd_maxspecial]<br />

and may be accessed from the command line<br />

"<br />

}<br />

The default pathname for the -f and -u commands is $CDPath<br />

The default filename for the -f and -u commands is $CDFile<br />

Set the following environment variables:<br />

CDL_PROMPTLEN - Set to the length of prompt you require.<br />

Prompt string is set to the right characters of the<br />

current <strong>di</strong>rectory.<br />

If not set then prompt is left unchanged<br />

CDL_PROMPT_PRE - Set to the string to prefix the prompt.<br />

Default is:<br />

non-root: \"\\[\\e[01;34m\\]\" (sets colour to blue).<br />

root: \"\\[\\e[01;31m\\]\" (sets colour to red).<br />

CDL_PROMPT_POST - Set to the string to suffix the prompt.<br />

Default is:<br />

non-root: \"\\[\\e[00m\\]$\" (resets colour and <strong>di</strong>splays $).<br />

root: \"\\[\\e[00m\\]#\" (resets colour and <strong>di</strong>splays #).<br />

CDPath - Set the default path for the -f & -u options.<br />

Default is home <strong>di</strong>rectory<br />

CDFile - Set the default filename for the -f & -u options.<br />

Default is cdfile<br />

cd_version<br />

cd_version ()<br />

{<br />

printf "Version: ${VERSION_MAJOR}.${VERSION_MINOR} Date: ${VERSION_DATE}\n"<br />

}<br />

#<br />

# Truncate right.<br />

749

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

Saved successfully!

Ooh no, something went wrong!