Re: extra slash in current path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Thu, Jun 23, 2011 at 10:52 AM, Lars Täuber <taeuber@xxxxxxx> wrote:
> Am Thu, 23 Jun 2011 18:31:06 +0400
> Michael Tokarev <mjt@xxxxxxxxxx> schrieb:
>> 23.06.2011 18:11, yuyichao-mit wrote:
>>
>> >>>> $ cd //
>> >>>> $ pwd
>> >>>> //
>>
>> The current directory is cached in $PWD environment
>> variable by shell (bash at least).  This variable is
>> checked in glibc (getcwd() et al) - if it is set and
>> stat($PWD) is the same as stat("."), that value is used.
>
> It also is somehow cached inside bash/dash for it's built in commands.
> $ cd //
> $ export PWD=5

this PWD=5 is not necessary.

> $ pwd
> //
> $ /bin/pwd
> /

$ export PWD=////
$ /bin/pwd
/
$ pwd
//
$ echo $PWD
////
$ a.out (simply output get_current_dir_name())
////
so getcwd indeed use $PWD (for symlink?) but pwd and /bin/pwd both
simplify the output although bash simplify it in a strange way~~~

~~interesting

>
>
> Regards
> Lars
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

Add to Google Powered by Linux