m-cli
m-cli copied to clipboard
Bash 5.1 errors, unary operator expected
When issuing the following command:
m itunes status
I get the following error:
bash-5.1# m itunes status 29:41: syntax error: A identifier can’t go after this identifier. (-2740) iTunes is currently . /usr/local/m-cli/plugins/itunes: line 30: [: =: unary operator expected bash-5.1#
Like 30 of that file reads:
if [ $state = "playing" ]; then
This error presents in bash and zsh, though the script is specifically calling bash. I tried this with the MacOS-supplied /bin/bash as well, same error.
@forrie The issue is caused by the fact that iTunes changed name to Music.
Try the following:
osascript -e 'tell application "Music" to get player state as string'
This PR should fix this issue, https://github.com/rgcr/m-cli/pull/191