Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
up vote 0 down vote accepted

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
share|improve this answer

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.