Skip to content
EntityQ283438· pop 32· linked from 323 articles

Also known as CHDIR(), change directory, A Quick Introduction to Unix/Changing Directories

Unix-commando

Key facts

Developers
AT&T Bell Laboratories , MetaComCo , Microsoft , IBM , DR , Novell , HP , JP Software , ReactOS Contributors
Operating system
Unix , Unix-like , V , DOS , MSX-DOS , FlexOS , OS/2 , TRIPOS , Windows , MPE/iX , Plan 9 , Inferno , ReactOS , KolibriOS , SymbOS
Platform
Cross-platform
Type
Command

via Wikipedia infobox

Described at

5. Starting with the first pathname in the -separated pathnames of CDPATH (see the ENVIRONMENT VARIABLES section) if the pathname is non-null, test if the concatenation of that pathname, a character if that pathname did not end with a character, and the directory operand names a directory. If the pathname is null, test if the concatenation of dot, a character, and the operand names a directory. In either case, if the resulting string names an existing directory, set curpath to that string and proceed to step 7. Otherwise, repeat this step with the next pathname in CDPATH until all pathnames have been tested. 1. Dot components and any characters that separate them from the next component shall be deleted. 2. The preceding component, all characters separating the preceding component from dot-dot, dot-dot, and all characters separating dot-dot from the following component (if any) shall be deleted. 9. If curpath is longer than {PATH MAX} bytes (including the terminating null) and the directory operand was not longer than {PATH MAX} bytes (including the terminating null), then curpath shall be converted from an absolute pathname to an equivalent relative pathname if possible. This conversion shall always be considered possible if the value of PWD, with a trailing added if it does not already have one, is an initial substring of curpath . Whether or not it is considered possible under other circumstances is unspecified. Implementations may also apply this conversion if curpath is not longer than {PATH MAX} bytes or the directory operand was longer than {PATH MAX} bytes. If, during the execution of the above steps, the PWD environment variable is set, the OLDPWD environment variable shall also be set to the value of the old working directory (that is the current working directory immediately prior to the call to cd ). Handle the operand dot-dot logically; symbolic link components shall not be resolved before dot-dot components are processed (see steps 8. and 9. in the DESCRIPTION). Handle the operand dot-dot physically; symbolic link components shall be resolved before dot-dot components are processed (see step 7. in the DESCRIPTION). which changes to the previous working directory and then writes its name. The name of the directory, used when no directory operand is specified. Provide a default value for the internationalization variables that are unset or null. (See XBD Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) If set to a non-empty string value, override the values of all the other internationalization variables. Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. [XSI) ] ![[Option Start]]( Determine the location of message catalogs for the processing of LC MESSAGES. ![[Option End]]( The use of the CDPATH was introduced in the System V shell. Its use is analogous to the use of the PATH variable in the shell. The BSD C shell used a shell parameter cdpath for this purpose. This behavior is now the default. It is not consistent with the definition of dot-dot in most historical practice; that is, while this behavior has been optionally available in the KornShell, other shells have historically not supported this functionality. The logical pathname is stored in the PWD environment variable when the cd utility completes and this value is used to construct the next directory name if cd is invoked with the -L option. The -L and -P options are added to align with the IEEE P1003.2b draft standard. This also includes the introduction of a new description to include the effect of these options. IEEE Std 1003.1-2001/Cor 1-2002, item XCU/TC1/D6/14 is applied, changing the SYNOPSIS to make it clear that the -L and -P options are mutually-exclusive. Austin Group Interpretation 1003.1-2001 199 is applied, clarifying how the cd utility handles concatenation of two pa

Excerpt from a page describing this subject · 15,734 chars · not written by Vinony

Wikidata facts

Image
Cd command.png
Show 4 more facts
Sources (5)

via Wikidata · CC0

Article · Nederlands

Het commando cd (change directory) wordt op Unix en Unix-achtige systemen gebruikt om de huidige te wijzigen. Meestal zal het commando met één argument aangeroepen worden; dat argument bevat dan het (absolute of relatieve) pad naar de nieuwe directory. Als het commando zonder argumenten aangeroepen wordt, verandert de huidige werkdirectory in de waarde van de $HOME, waarin de thuisdirectory van de gebruiker staat. Als die variabele om wat voor reden dan ook niet gezet is zal het commando falen. Datzelfde zal uiteraard ook gebeuren als de opgegeven directory niet bestaat of niet toegankelijk is. Omdat cd de toestand van het huidige proces verandert (namelijk de werkdirectory) moet het in de shell ingebouwd worden en kan het geen apart programma zijn, want onder Unix kunnen dochterprocessen niet de toestand van hun ouderproces veranderen. In modernere shells wordt het pad naar de oorspronkelijke directory opgeslagen in $OLDPWD en het pad naar de nieuwe directory wordt opgeslagen in $PWD. Met cd - kan dan naar de "vorige" directory teruggegaan worden. Op dat moment veranderen $PWD en $OLDPWD van plaats, oftewel nogmaals cd - gaat niet "nog verder terug"! In modernere shells is het tevens mogelijk om twee argumenten mee te geven. In dat geval wordt in de naam van de huidige directory het eerste voorkomen van het eerste argument, vervangen door het tweede argument. De resulterende naam is de naam van de directory waar men naartoe gaat. Voorbeeld: de huidige directory: /home/jan/literatuur/engelsde gebruiker geeft het commando cd jan pietde nieuwe directory wordt dan: /home/piet/literatuur/engels Het equivalent in POSIX C is de functie chdir in unistd.h.

Abstract from DBpedia / Wikipedia · CC BY-SA