|
From: | bash |
Subject: | Re: Spaces in args, escapes, and command substitution |
Date: | Sun, 29 Oct 2006 14:42:40 +1100 |
> >Word splitting is controlled by IFS. Use IFS=$'\n' to only split on >newlines. > >Andreas. Well, I still dont see any examples. I don't think it is possible even using IFS. Even if it does work somehow, it isn't easy or intuitive. But there is worse. Try and run the following script: ----------- f1="/a/b/a-000" f2="/a/b/c d-000" touch "a-000.ext" touch "c d-000.ext" for file in "$(basename \"$f1\")"*.ext "$(basename \"$f2\")"*.ext do echo "one=$file" done for file in "`basename \"$f1\"`"*.ext "`basename \"$f2\"`"*.ext do echo "two=$file" done ----------- The backticks work perfectly. But the $() gets it very wrong and leaves a double-quote in the result. The two methods should be exactly equivalent when there is no nesting. Regards bahser
[Prev in Thread] | Current Thread | [Next in Thread] |