I have a script which takes input for two variables from users. Then, I try to use those variables in a command which is in turn being fed into a condition in an if. However, the user input value is not replacing my variables and as a result, my command is not working -
# Get acl and dc values echo "Type the ACL name:" read acl echo "Type the DATACENTER name" read dc # see if sw-list-cisco file exists in ~/$acl directory" if [ ` ls -1 ~/$acl/sw-list-cisco > /dev/null | wc -l ` -gt 0 ]; then echo "Going to do something" else echo "no match !!!!!!!!!!!!!" fi
if [ ` ls -1 ~/"$acl"/sw-list-cisco > /dev/null | wc -l ` -gt 0 ]; condition doesn't seem to be replacing $acl with the user input value. I have verified manually that
sw-list-cisco exists in the
~/$acl directory. What am I missing?