Question : Can't parse arguments via variables in Bash

I have with following bash script (section displayed in code area below). I'm trying to specify the arguments i send to ec2-create-volume by placing them in a variable but if I place them in a variable they don't pass to ec2-create-volume, it appears to be a limitation.

If I echo "ec2-create-volume $ARGUMENTS --availability-zone $AVAILABILITY_ZONE" and then copy paste the command created it works fine but if I have the bash script try to run it it doesn't work.
Code Snippet:
1:
2:
3:
4:
if [ $(RM_SPACE ${CREATE_EBS[0]}) ]; then  ARGUMENTS="--snapshot $(RM_SPACE ${CREATE_EBS[0]})"; fi
if [ $(RM_SPACE ${CREATE_EBS[1]}) ]; then  ARGUMENTS="$ARGUMENTS --size $(RM_SPACE ${CREATE_EBS[0]})"; fi
 
ec2-create-volume $ARGUMENTS --availability-zone $AVAILABILITY_ZONE
Open in New Window Select All

Answer : Can't parse arguments via variables in Bash

Turns out the reason this wasn't working is I'd set IFS=","

The solution was :
  OLDIFS=$IFS
  IFS=","
  # some commands I need to run with the new IFS
   IFS=$OLDIFS

Random Solutions  
 
programming4us programming4us