{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Dale - Computer Science Illuminated 388

Dale - Computer Science Illuminated 388 - path is located...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
11.2 Directories 361 specify a specific document (as it does in the first two examples) or an entire subdirectory (as it does in the third example). Absolute paths in a Unix system work the same way, except that the character used to separate subdirectories is the forward slash ( P ). Here are some examples of absolute path names that correspond to the directory tree in Figure 11.5: PcD P9,x Pz9OP > O! "D PO#!O’ PR xP#!O,#P ,Fz P"!x9R z P‘!FzP FD9‘PxzI!x9 P zz’/i9d9 Relative paths are based on the current working directory. That is, they are relative to your current position (hence the name). Suppose the current working directory is 10–C> 8!ORFz 9 –#z99zx (from Figure 11.4). Then the following relative path names could be used: O, Oz#C, iT!O ,II#DO,9D! –O,#)9,9ziT!O The first example just specifies the name of the file, which can be found in the current working directory. The second example specifies a file in the applications subdirectory. By definition, the first part of any valid relative
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: path is located in the working directory. Sometimes when using relative path we need to work our way back up the tree. Note that this was not an issue when using absolute paths. In most operating systems, two dots (. .) are used to specify the parent direc-tory (a single dot is used to specify the current working directory). There-fore, if the working directory is 10–C> 8!ORFz 9 –#z99zx , the following are also valid relative paths: ii–#, T O,Izi*I ii–O O/K/–Ix!*Ni*,S, ii–ii–2678.2)–8xDSzx –W;;61i61C ii–ii–hx! x,F D#z –2D uDI Unix systems work essentially the same way. Using the directory tree in Figure 11.5, and assuming that the current working directory is P‘!FzP*! z , the following are valid relative paths: R9D#D9Dz PO!FcD z iiP FD9‘PxzI!x9 iiPiiPTzSP99>Wt/ iiPiiPR xPF, PF, /P# i/i p...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online