So as the question suggests, I want to get the version of a command inside a bash script, instead of using the terminal.
I know that all available commands are present as files inside the directory /usr/bin. But it does not give the versions and it gives some funny information when you use cat for one of the (command) files.
for example - cat /usr/bin/man gives -
What is this and how do I get the version?
I am using Ubuntu 20.04.
I know its a stupid question to ask here but I wasn't able to find anything :/
Final edit - the first answer works, I am using the function.
Sorry, I got confused myself 😅
