To know the version of bash that is available on your device make use of --version option along with the bash.
Example:$ bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.
You do not need to be on the bash shell in order to know the version, in the below example the same command works on the zsh or sh shell as well.
% bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.
% sh
sh-3.2$ bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.
sh-3.2$
You would get a command not found error if you use single dash with version option!
$ -version
-version
bash: -version: command not found
- How to Assign Bash Command to Variable
- How to Kill a port using bash terminal command?
- Bash For Loop Example
- bash: netstat: command not found
- Bash getopts Command Example
- How to fix bash ping command not found error
- [Fix] bash: script.sh: /bin/bash^M: bad interpreter: No such file or directory
- [fix] bash: ssh: command not found
- Fix bash: script.sh: Permission denied Error
- bash: ls command to see list files in current directory all subdirectories
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command
- How to use Autocomplete and Autosuggestion in Shell Commands
- Bash Hello World! Script Tutorial
- Install Bash Completion on macOS
- bash get year 2021 calendar
- How to create new user account in Windows bash
- Bash command to wait for seconds
- Know Bash shell version command
- How to start or open a new bourne-again shell (bash) session on Windows using Command Line CMD
- How to check your IP using bash for Windows?
- Bash Script to prefix files with sequential numbers in a directory
- How to Compare Strings in Bash
- Command to Sort File In Reverse Order [Unix/Linux/macOS]
- How to know the current shell you are logged in?
- List all Username and User ID using Bash Command
- Get Desc of Table using Java JDBC - Java
- JSON with PHP Example: JSON Tutorial - Json-Tutorial
- [Fix] Minecraft Error: A JNI error has occurred, please check your installation and try again - HowTos
- Where are Plugins Installed in Notepad++ - NotepadPlusPlus
- Fix: zsh: command not found: aws (Mac/macOS) - AWS
- Java equals method - Tutorial - Java
- Read YAML file Java Jackson Library - Java
- 10 Beginners Commands for macOS Terminal Usage - MacOS