I wanted to create a script that executes the ls command with the provided arguments. Why isn't it working?I tried running it with for example -R, then it echoes (I echoed the same thing for comparison):    ls -Rbut says that it cannot access -R:  no such file or directory. But when I execute ls -R in the terminal, it works.The script itself:text='ls'while [[ $# -gt 0 ]]do    text+=' '    text+=$1    text+=''    shiftdoneecho 'ls -R'echo $text$text
Bash script is not working
bash;shell script;quoting
The wrong quoting is the problem.  does not quote (and, which is the problem here, does not get removed!) if it is contained in a variable. Exception: eval $textYou should assign the parameters to an array and use ls ${vars[@]} or ls $@ instead.Compare the two calls:set -xls -lls -lset +x