Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have this line in a function I'm adapting from a bash function into zsh function:

local info=( $(command df -P $fs | awk 'END{ print $2,$3,$5 }') )

Whenever I call it in the func I get this:

mydf:9: bad pattern: info=( 712687280

But when I call it from the shell I get the expected answer:

$ info=($(command df -P $fs | awk 'END{ print $2,$3,$5 }'))
$ echo $info                                                                                      
712687280 166242288 25%

I am 2 days into zsh so I'm a little ignorant as to what's causing the problem.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Put the assignment on a separate line from the local definition:

local info
info=( $(command df -P $fs | awk 'END{ print $2,$3,$5 }') )
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.