bash error declare: -A: invalid option

Note Statistics

Note Statistics

  • Viewed 439 times
Tue, 09/15/2020 - 18:04

Are you getting the error below?

declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]

This might occur because you have a old version of Bash. Hash tables are supported natively only from Bash 4.

Run the command below to check your bash version

bash --version

You might get something like this

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.

If you using mac you can run the command below

brew update && brew install bash
Authored by
Tags