Hoi everybody,
I am currently struggling with having to execute multiple commands in an echo. The following line is an example of the problem I am having:
echo (cd .. && pwd)
The idea is, that, when I am currently in the folder "home/Documents", the above code prints "home" - but is still in the directory "home/Documents". However, the above command fails.
The more general question is: How can I execute multiple commands in an echo and print the last result (or all results if its not possible any other way).
Thank you and kind regards.
echo
is not the right tool. I remember your previous question, you seem to abuseecho
. Please see XY problem. What are you really trying to do with this contraption?echo (cd .. && pwd) bash: syntax error near unexpected token cd'
echo `pwd`
?" is a good start.