On 4/7/21 6:48 AM, lb@xxxxxxxxxx wrote:
Bad idea, or just a style "this is proper practice" sort of thing?I can't imagine any 'bad idea' from this, as it is doing the same basic thing.
Stephane is correct. It's actually a bug which I occasionally tickle. I've just never been motivated to do anything about it.
The bug is when I would try to p(ush)d to a directory that doesn't exist, e.g. typo. I end up unwittingly doing a popd backwards.
I just actually hacked this together. pd () { [ $# -eq 1 ] && pushd "${1}" [ $# -eq 0 ] && popd }I should have expected (and did) that my function would be scrutinized. Which I'm cool with. But even my buggy version demonstrates that function parameters do work, which is what the OP's question was about. ;-)
-- Grant. . . . unix || die
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature