m-cli icon indicating copy to clipboard operation
m-cli copied to clipboard

Bash 5.1 errors, unary operator expected

Open forrie opened this issue 3 years ago • 1 comments

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 avatar Feb 17 '22 17:02 forrie

@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'

limakzi avatar Jul 08 '22 01:07 limakzi

This PR should fix this issue, https://github.com/rgcr/m-cli/pull/191

rgcr avatar Feb 13 '23 18:02 rgcr