Issue with recursive script passing arguments
I am writing a backup script for my server that calls itself recursively in each subdirectory. In doing so, it uses variables as the arguments and the problem I'm encountering is when directories have spaces. If I put double quotes around the variable names, they still are seen as multiple arguments if they have spaces in them. Basically, this is the recursive line in the script...
$0 "$target/$subdir" "$source/*"
So, if $target or $subdir has a space, then "$target/$subdir" will be seen as multiple arguments. Same with $source and "$source/*". Can anyone tell me how to use these variables in such a way that they will be seen as a single argument by the recursively called script?