ssh-ssm.sh on macOS
mdegis opened this issue · 1 comments
Description
Whenever I'm trying to use ssh-ssm.sh
, it throws an error:
./ssh-ssm.sh: line 12: conditional binary operator expected
./ssh-ssm.sh: line 12: syntax error near `"AWS_PROFILE"'
./ssh-ssm.sh: line 12: `[[ ! -v "AWS_PROFILE" ]] && printf " AWS_PROFILE not set!\n" && exit 1'
Platform Details
macOS 10.15.3
bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc
zsh --version
zsh 5.7.1 (x86_64-apple-darwin19.0)
Workaround
I've changed the shebang line to #!/usr/bin/env zsh
and it is working now.
I'm not sure if it is only me or general problem. This issue can be closed if it is about personal setup error.
Thanks for the great tool! ⭐️
Unfortunately, this is due to the old version of bash shipped with macOS. The '-v' argument to the bash test
builtin [0] was added in bash 4.2.
I've implemented a workaround to accommodate mac users. You can always consider upgrading your version of bash with brew install bash
:)
[0] https://www.gnu.org/software/bash/manual/html_node/Bash-Conditional-Expressions.html