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
.
cd "$(mktemp | tail -n1 | cut -d: -f2)"
– Arkadiusz Drabczyk Apr 24 '19 at 08:11