rlue/timer

Line 61: ${1^} complete: bad substitution

Closed this issue · 4 comments

Every time I tried putting more than one argument, this happens:
Screen Shot 2022-07-12 at 2 22 11

rlue commented

Oops. Are on macOS? (or otherwise running an older version of bash?)

The carat (^) in that expression capitalizes the first letter of the variable, which was introduced in bash 4. Meanwhile, macOS uses bash 3.2, which is from 2007 (!):

The reason that Apple includes such an old version of Bash in its operating system has to do with licensing. Since version 4.0 (successor of 3.2), Bash uses the GNU General Public License v3 (GPLv3), which Apple does not (want to) support... Version 3.2 of GNU Bash is the last version with GPLv2, which Apple accepts, and so it sticks with it.

An easy fix is to brew install bash.

Ninja Edit

I have amended the homebrew formula to add bash as a dependency. Try this instead:

$ brew update
$ brew install --force rlue/utils/timer

I'm using zsh 5.8.1 actually.

rlue commented

Sure! zsh is the default on macOS these days. But timer is a bash script; when you run it, the shebang on the first line tells your shell to run it in bash:

#!/usr/bin/env bash

which means that its behavior will depend on which version of bash is on your system.

Did you try force-reinstalling timer and/or manually installing bash with homebrew?

Yes! And it completely worked. Thank you very much!