I'm having trouble converting a shell script to zsh. I have the following array defined, but it is throwing the error unknown file attribute: \n
. (I'm converting a dotfiles repo to my zsh)
declare -r -a FILES_TO_SOURCE=(
"bash_aliases"
"bash_exports"
"bash_functions"
"bash_options"
"bash_prompt"
"bash.local"
)
From man zshbuiltins
, under the entry for typeset
(of which declare
is a synonym):
For each name=value assignment, the parameter name is set to value. Note that arrays currently cannot be assigned in typeset expressions, only scalars and integers.
Try this instead:
declare -a FILES_TO_SOURCE
FILES_TO_SOURCE=(
"bash_aliases"
"bash_exports"
"bash_functions"
"bash_options"
"bash_prompt"
"bash.local"
)
declare -r FILES_TO_SOURCE
That being said that list of files is going to have to change here too most likely for compatibility (assuming you've used bash-isms in those files which seems likely).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With