linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: 俞颐超 <yyc1992@gmail.com>
To: linux-kernel@vger.kernel.org, linux-c-programming@vger.kernel.org
Subject: Re: extra slash in current path
Date: Thu, 23 Jun 2011 11:02:26 -0400	[thread overview]
Message-ID: <BANLkTi=AeqT1CmiiNUXOcxYPe9=ORKME9g@mail.gmail.com> (raw)
In-Reply-To: <BANLkTimdzyT6w2LoKtTjhHTKF5d6zWXFGw@mail.gmail.com>

On Thu, Jun 23, 2011 at 10:52 AM, Lars Täuber <taeuber@bbaw.de> wrote:
> Am Thu, 23 Jun 2011 18:31:06 +0400
> Michael Tokarev <mjt@tls.msk.ru> 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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

      parent reply	other threads:[~2011-06-23 15:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-23 13:14 extra slash in current path yuyichao-mit
2011-06-23 13:17 ` Alessandro Suardi
     [not found]   ` <BANLkTik3iMqZJiEY1+DYS2T9=+q2x2=5pQ@mail.gmail.com>
2011-06-23 13:26     ` yuyichao-mit
     [not found] ` <20110623153116.404f2a63.taeuber@bbaw.de>
     [not found]   ` <BANLkTinOb-4Xm_W2fmzivk6jBJwjeHYKVA@mail.gmail.com>
     [not found]     ` <BANLkTimXH8K91cZ69oPRu=wbYt9JgBadfA@mail.gmail.com>
2011-06-23 14:11       ` yuyichao-mit
2011-06-23 14:25         ` richard -rw- weinberger
2011-06-23 14:27         ` Nick Bowler
2011-06-23 14:31         ` Michael Tokarev
2011-06-23 14:53           ` yuyichao-mit
     [not found]           ` <20110623165206.d88dcbb3.taeuber@bbaw.de>
     [not found]             ` <BANLkTimdzyT6w2LoKtTjhHTKF5d6zWXFGw@mail.gmail.com>
2011-06-23 15:02               ` 俞颐超 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTi=AeqT1CmiiNUXOcxYPe9=ORKME9g@mail.gmail.com' \
    --to=yyc1992@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).