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

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

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

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

/home/phil/umm/ummdev$ # Current <strong>di</strong>rectory is S<br />

To go to a <strong>di</strong>rectory called, for example, 1:<br />

/home/phil$ cd -g 1 # -g ignores the special<br />

/home/phil/1$<br />

To put current <strong>di</strong>rectory on the special list as S1:<br />

cd -r1 . # OR<br />

cd -R1 . # These have the same effect if the <strong>di</strong>rectory is<br />

#+ . (the current <strong>di</strong>rectory)<br />

To go to a <strong>di</strong>rectory and add it as a special<br />

The <strong>di</strong>rectory for -r or -R may be a number. For example:<br />

$ cd -r3 4 Go to history entry 4 and put it on special entry 3<br />

$ cd -R3 4 Put current <strong>di</strong>r on the special entry 3 and go to<br />

history entry 4<br />

$ cd -s3 Go to special entry 3<br />

Note that commands R,r,S and s may be used without a number and<br />

refer to 0:<br />

$ cd -s Go to special entry 0<br />

$ cd -S Go to special entry 0 and make special entry 0<br />

current <strong>di</strong>r<br />

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

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

Alternative suggested <strong>di</strong>rectories:<br />

If a <strong>di</strong>rectory is not found, then CD will suggest any<br />

possibilities. These are <strong>di</strong>rectories starting with the same letters<br />

and if any are found they are listed prefixed with -a<br />

where is a number. It’s possible to go to the <strong>di</strong>rectory<br />

by entering cd -a on the command line.<br />

Configuration<br />

Use cd -d or -D to change default cd action. cd -H will show<br />

current action.<br />

The history entries (0-n) are stored in the environment variables<br />

CD[0] - CD[n]<br />

Similarly the special <strong>di</strong>rectories S0 - 9 are in the environment<br />

variable CDS[0] - CDS[9]<br />

and may be accessed from the command line, for example:<br />

ls -l ${CDS[3]}<br />

cat ${CD[8]}/file.txt<br />

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

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

759

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

Saved successfully!

Ooh no, something went wrong!