Suppose I have a program called mktemp which creates a random tmp directory in /tmp and also produces a string output of the directory address

Input[0]: mktemp
Output[0]: /tmp/tmp.MkrKAscwwk

How can I redirect the output of mktemp so that I can change my directory to that I just created? Meaning I Don't have to do cd /tmp/tmp.MkrKAscwwk.

marked as duplicate by pLumo, Prvt_Yadv, Kusalananda bash Apr 24 at 8:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.