0

I am writing a very simple script which will link shared configuration files. For some reason it does not behave as i expected for file with underscore in name. Does _ (underscore) means something special in zsh?

The mentioned script as it is now:

#!/bin/zsh
STATIC_CONFIG_PATH="/opt/apps/config"
STATIC_CONFIG_FILES=("couchdb.yml" "database.yml" "elasticsearch.yml" "slurm_api.yml")


cd $1/config
ELEMENTS=${#STATIC_CONFIG_FILES[@]}
for (( i=0;i<$ELEMENTS;i++)); do
  if [ ! -L ${STATIC_CONFIG_FILES[${i}]} ]; then
    echo 'Linking '$STATIC_CONFIG_PATH'/'${STATIC_CONFIG_FILES[${i}]}
    ln -s $STATIC_CONFIG_PATH'/'${STATIC_CONFIG_FILES[${i}]}
  fi
done
0

Never mind. There is no underscore mistery

slurm_api.yml is ${STATIC_CONFIG_FILES[4]} so the for should be like a

for (( i=1;i<=$ELEMENTS;i++)); do

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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