I would like to obtain the version number of dot (part of the Graphviz suite) captured into a bash script variable. I have managed with a number of other cli commands such as cmake and doxygen, but am stumped by dot. It appears to me that the version information is pushed by stderr or other means to output on the screen. I have tried awk, cut, sed with redirecting stderr to stodut even /dev/null but still my variable remains empty and the version details are published to the screen. Can anyone please provide me with the means to achieve this? Thanks and kind regards, jB
Asked
Active
Viewed 25 times
0
-
Redirect stderr to stdout using `2>&1` - so, for example: `foo=$(dot -V 2>&1)`. I know you mentioned that you tried that (you did not show us exactly what you tried), but it works for me on Ubuntu with bash. – andrewJames Sep 28 '22 at 12:22
-
1Does this answer your question? [Redirect to stdout in bash](https://stackoverflow.com/questions/17968856/redirect-to-stdout-in-bash) If it does not answer your question, then please [edit] your question and provide specific details of what you tried (show us the commands). – andrewJames Sep 28 '22 at 12:22
-
1Heaven only knows why my script didn't work earlier. It was exactly like yours. I copied and pasted you code next to mine and it works. Still mystified but very relieved. Thank you – britesc Sep 29 '22 at 15:01