Zsh bad substitution error when installing Influxdb2.0

Solution 1:

${DISTRIB_ID,,} is a Bash-specific parameter expansion to lowercase the value of the variable.

https://askubuntu.com/a/383360/25077 suggests ${(L)DISTRIB_ID} as a corresponding operation in Zsh.

But there is no real reason for this to use any constructs specific to either shell; the operation is simple to do portably in POSIX sh too (albeit at the cost of an external process).

For what it's worth, unless there are other reasons you need to, the export statements here are unnecessary, too. See also Correct Bash and shell script variable capitalization

distrib_id=$(lsb_release -si | tr A-Z a-z)
distrib_codename=$(lsb_release -sc)
echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/$distrib_id $distrib_codename stable" | sudo tee /etc/apt/sources.list.d/influxdb.list > /dev/null