209

(learning bash) I was trying to check the bash version so I typed /bin/bash -v.

That outputted a whole lot of text to the screen (contents of .bashrc, and other files sourced from it).

Could I have screwed up something (like overwriting some config files/setting incorrect environment variables etc.) due to that command?

I also can't find documentation on what the -v switch is for.

Jorge Castro
  • 73,717
Zabba
  • 3,695

6 Answers6

202

The -v parameter for bash stands for verbose, and instructs bash to print out as much information as possible about what it is doing. On startup, it will print out all the configuration it is reading in.

To print out the version information for bash, use bash --version.

Flimm
  • 44,031
123

When running bash (e.g. from gnome-terminal) you can check value of BASH_VERSION environment variable.

$ echo $BASH_VERSION
4.2.37(1)-release

If the value is empty, you are not running bash.

45

There's a key shortcut that instructs current shell information to show up:

Ctrl+x Ctrl+v

From man bash

   display-shell-version (C-x C-v)
          Display version information about the current instance of bash.

This is the best choice if you have messed with environment variables.

MD XF
  • 107
vegatripy
  • 551
  • 4
  • 5
9

No, everything is alright. From man bash:

   --verbose
          Equivalent to  -v.

It is just not as silent as usual. Try

--version 

instead.

user unknown
  • 6,892
4

The usual --version may give you too much multi-line boilerplate so what I am using is

bash -c 'echo $BASH_VERSION'
sorin
  • 10,135
2

To only get the version and not the multiline text:

$ bash --version | head -1 | cut -d ' ' -f 4