Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

219
Visualizações
Zsh bad substitution error when installing Influxdb2.0

I am following the installation instructions from this article but I get a bad substitution error from zsh when executing this command:

export DISTRIB_ID=$(lsb_release -si); export 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

What am I supposed to change for zsh?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

${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
over 4 years ago · Santiago Trujillo Relatório

0

As the comment in the original post says the ${DISTRIB_ID,,} is used in bash to expand the parameter in lower case. The same in zsh is done by ${DISTRIB_ID:l}.

So the whole working command in zsh is:

export DISTRIB_ID=$(lsb_release -si); export DISTRIB_CODENAME=$(lsb_release -sc)
echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/${DISTRIB_ID:l} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list > /dev/null
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda