Bash script not handling quoted arguments with spaces correctly when passed to function
I'm a bit lost with I'm maintaining legacy code that I can't seem to get I'm working with an scenario with a Bash script where I need to pass arguments containing spaces to a function, but they are not being handled as expected. For example, I have the following script: ```bash #!/bin/bash my_function() { echo "First argument: $1" echo "Second argument: $2" } my_function "Hello World" "Shell Scripting" ``` When I run this script, the output is: ``` First argument: Hello Second argument: World ``` It seems that the function is splitting the first argument at the space, which is not the behavior I want. I've tried escaping the spaces with backslashes and using single quotes, but neither approach works. I also attempted to use an array to hold the arguments, but that didn’t yield the correct output either. I would expect the output to be: ``` First argument: Hello World Second argument: Shell Scripting ``` What am I missing here? How can I ensure that my function correctly receives arguments with spaces intact? Is there a specific quoting or argument-passing technique I should adopt for Bash scripts? I'm running this on Bash version 5.1.8 on Ubuntu 20.04. Any insights would be appreciated. What would be the recommended way to handle this? Has anyone dealt with something similar?