LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Issue with recursive script passing arguments (http://www.linuxquestions.org/questions/linux-newbie-8/issue-with-recursive-script-passing-arguments-132209/)

gauge73 01-06-2004 07:16 PM

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?


All times are GMT -5. The time now is 12:55 PM.