[so] Comanda 'cd'

Octavian Purdila so@atlantis.cs.pub.ro
Fri, 31 Oct 2003 16:50:26 +0200


>
> Nu inteleg intrebarea.
>
> OP> Sunt in '/root/so' si primesc comanda 'cd ../../bin'. Calea relativa
> '../../bin' trebuie adusa la forma canonica '/bin'. Exista functie in 
> Linux
> pt asa ceva?
>

chdir() ca si alte apeluri UNIX ce folosesc cai,
lucreaza si cu cai relative, pentru ca fisierele "." si ".." chiar exista 
pe disc.

bash-2.05b$ pwd
/home/tavi/tmp
bash-2.05b$ stat . | grep Inode
Device: 302h/770d       Inode: 1550533     Links: 3
bash-2.05b$ stat ../tmp | grep Inode
Device: 302h/770d       Inode: 1550533     Links: 3
bash-2.05b$ stat aaa/.. | grep Inode
Device: 302h/770d       Inode: 1550533     Links: 3

Directorul /home/tavi/tmp (inode 1550533) are doua link-uri hard  catre el:
"/home/tavi/tmp/." si "/home/tavi/tmp/aaa/..", deocamdata, pentru ca daca

bash-2.05b$ mkdir bbb
bash-2.05b$ stat . | grep Inode
Device: 302h/770d       Inode: 1550533     Links: 4
                                                                        |
atunci.... ---------------------------------------------------------|

tavi