I have a string that contains something like this:
apple orange pear grapes
And I have a command that works like this:
eat food [additionalFood [additionalFood [additionalFood...]]
If I do eat $s, then it will treat the whole string as one big food. How can I break up the string into passable arguments?
It shouldn’t treat that as one big string. Example:
test.sh
Command-line
Output
If this isn’t working for you, it’s possible your
IFSvariable is set to a non-default value.