On Thu, Jun 16, 2022, 10:37 AM Greg Wooledge <greg@wooledge.org> wrote:
> On Thu, Jun 16, 2022 at 01:29:01PM +0800, lumianshuo@DELL via wrote:
> > Hello , when I use the cd and dirs. Sometimes I need the last‘OLDPWD is
> cur PWD or not .
> > Alright I can record the var at the begin. But if can I judge this by a
> tool that shell given? i.e. have the shell save the “last” OLDPWD ? If have
> , where have it saved?
>
> Have a look at pushd and popd. Otherwise, there's always saving $PWD
> into another variable, as you already said.
>
In addition to pushd and popd, look at the dirs command and the DIRSTACK
array.
>