Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to pipe pwd into pushd

Tags:

bash

How can I pipe in the output of pwd to pushd so that I can use pushd on the current directory. I've tried

pwd | pushd

and lots of other combinations but nothing seems to work.

like image 379
fergusdawson Avatar asked Nov 30 '22 03:11

fergusdawson


2 Answers

Just use:

pushd $PWD

($PWD is maintained automatically by your shell.)

Or, if you really want an external pwd:

pushd $(/bin/pwd)
like image 35
Mat Avatar answered Feb 08 '23 00:02

Mat


pushd .

also works

like image 54
mob Avatar answered Feb 07 '23 23:02

mob