简体   繁体   中英

Store output of helm command in a variable

I am trying to store the output of my helm command in a variable in bash script and trying to echo it but it return giving an error..syntax error in expression

Here is my code MY_VAR=$((helm ls -A -o json)) echo ${MY_VAR}

To execute one command after another you must add && between them. Also, you do not need double parentheses.

For example:

MY_VAR=$(helm ls -A -o json) && echo ${MY_VAR}

Its because you got double brackets
Change into

 MY_VAR=$(helm ls -A -o json)

this solve the problem for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM