sonnenblen.de - Das unabhängige Sun User Forum

Betriebssysteme => Betriebssystem-Tips => Thema gestartet von: claus am 31. August 2006, 12:01:41

Titel: Netter Solaris Tip: CDPATH
Beitrag von: claus am 31. August 2006, 12:01:41
Schande über mich, das war mir völlig unbekannt und hätte ich oft benötigt...

Zitat
If you're like many Solaris users and administrators, you spend a lot of time moving back and forth between directories in similar locations. For
instance, you might often work in your home directory (such as "/home/al"), the /usr/local directories, web page directories, or other user's home
directories in /home.

If you're often moving back-and-forth between the same directories, and you use the Bourne shell (sh) or Korn shell (ksh) as your login shell, you can
use the CDPATH shell variable to save yourself a lot of typing, and quickly move between directories.

Here's a quick demo. First move to the root directory:

    cd /

Next, if it's not set already, set your CDPATH shell variable as follows:

CDPATH=/usr/spool

Then, type this cd command:

    cd cron

What happens? Type this and see what happened:

    pwd

The result should be "/usr/spool/cron".

When you typed "cd cron", the shell looked in your local directory for a sub-directory named "cron". When it didn't find one, it searched the CDPATH
variable, and looked for a "cron" sub-directory. When it found a sub-directory named cron in the /usr/spool directory, it moved you there.

You can set your CDPATH variable just like your normal PATH variable:

    CDPATH=/home/al:/usr/local:/usr/spool:/home


Quelle: mir gerade entfallen :(

Claus
 
Titel: Re: Netter Solaris Tip: CDPATH
Beitrag von: crutchy am 02. Oktober 2006, 14:10:55
Das funzt auch auf jeder Linux Kiste mit Bash ;-)
man bash

Bsp:
# export CDPATH=/usr/local
# cd bin
/usr/local/bin

Beste Grüsse
Titel: Re: Netter Solaris Tip: CDPATH
Beitrag von: claus am 02. Oktober 2006, 14:46:45
Ja, soweit hatte ich die Manpage von Bash nie gelesen, bzw vielleicht schon gelesen aber nicht bewusst registriert.
Wusste in der Abteilung aber keiner, ist aber auch keine Sysadmin-Abteilung ...

Claus