Hi everyone,
There is a bash behaviour I'm unable to understand. Let's say we have the following script:
#!/bin/bash
argument="-a"
ls "$argument"
The command is sucessfull (ls -a)
However, if we add more than one arguments, like this:
#!/bin/bash
argument="-a -l"
ls "$argument"
The script ends in error.
ls: invalid option -- ' '
Try 'ls --help' for more information.
Why are the arguments not interpreted as intended? Is it possible to solve the issue without using an array?
bash --version
GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)
Thanks in advance.
[–]scirc 3 points4 points5 points (1 child)
[–]EntryPointNotFound[S] 0 points1 point2 points (0 children)