because when MODE is unset the old approach lead the sh parser to trip over the test-syntax becoming [ = "development"] rather then [ "" = "development" ]
The more natural / elegant / simple / common strategy to this problem however is to simply use:
if [ "${MODE}" == "development" ]; then
This has the added benefit of even supporting MODE values that have spaces in them. Cause in the current setup one would still have the sh parser trip over a use case like
export MODE="my mode"
/start.sh
./start-rpio.sh: line 4: [: too many arguments
simply because the test-syntax ends up as [ my mode = "development" ] rather then the hoped for [ "my mode" = "development" ]
I understand having MODE values with spaces is pushing beyond normal expectations, but as said, the suggested fix is also the more readable and common way of doing things.
This fix --> https://github.com/mu-semtech/mu-python-template/commit/bb0afbfe40ff9dcb41fd28c74284c9a612083af0
introduced this line https://github.com/mu-semtech/mu-python-template/blob/2ea41ed744eae75ea7eabd4d481e0a32d3c13db8/start.sh#L3
most likely to prevent the warning
because when
MODE
is unset the old approach lead the sh parser to trip over the test-syntax becoming[ = "development"]
rather then[ "" = "development" ]
The more natural / elegant / simple / common strategy to this problem however is to simply use:
This has the added benefit of even supporting MODE values that have spaces in them. Cause in the current setup one would still have the sh parser trip over a use case like
simply because the test-syntax ends up as
[ my mode = "development" ]
rather then the hoped for[ "my mode" = "development" ]
I understand having MODE values with spaces is pushing beyond normal expectations, but as said, the suggested fix is also the more readable and common way of doing things.