Replies: 1 comment
-
I'm struggling to come up with a case where
So what I would do is
or something like
Once pushd failed you're already executing in an unintended directory. Not doing popd is the least of your problems. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Often times I will have a script that uses
pushd
andpopd
to manage the directory stack, but sometimes something fails and it ends uppopd
ing too many times. If this happens, I'd like to have it not mess with the directory stack as it was before the function executed. Thus, my idea ispushd --lock
and--unlock
. Whenever you lock the stack, entries that were in it at the time of lock are unusable, meaning if you try to runpushd ~/whatever; pushd --lock; popd
it will give you an error. That way, running popd too many times has no effect, instead of clearing the directory stack and continuing function execution in an unintended directory.Beta Was this translation helpful? Give feedback.
All reactions