I am writing a portable procedure (i.e. I am not using dpkg
) in a Bash script that ensures that certain program versions are available. I can get the version of indent
in the following way:
version_indent="$(echo "$(indent --version)" | cut -d" " -f3)"
I don't understand why I can't get the version of astyle
in a similar way:
version_astyle="$(echo "$(astyle --version)" | cut -d" " -f4)"
When I do the former, I get the actual version; when I do the latter, I get the full string returned by astyle
printed to the terminal and nothing saved to the variable. What's going wrong?