[Bug 685] [shell] return values with spaces are not escaped correctly
bugzilla at busybox.net
bugzilla at busybox.net
Tue Oct 27 18:30:20 UTC 2009
https://bugs.busybox.net/show_bug.cgi?id=685
--- Comment #1 from Denys Vlasenko <vda.linux at googlemail.com> 2009-10-27 18:30:17 UTC ---
Which shell you are testing, ash or hush?
> incorrect - e.g. #1:
> # for i in `find .`
Did you try it in bash? It also "fails" there. This is just how it should work
in this case.
You can use:
for i in "`find .`"
but this will jam *all* filenames into one $i. So probably:
find . | while read filename; do ...; done
Try this script:
#!/bin/sh
testing() {
echo "Testing $1"
rm -rf dir 2>/dev/null
mkdir dir
>"dir/a b"
echo "Test with find"
$1 -c 'for i in `find dir`; do echo $i; done'
echo "Test with ls"
$1 -c 'for i in `ls dir/a*`; do echo $i; done'
echo
}
testing "bash"
testing "./busybox ash"
testing "./busybox hush"
It outputs:
Testing bash
Test with find
dir
dir/a
b
Test with ls
dir/a
b
Testing ./busybox ash
Test with find
dir
dir/a
b
Test with ls
dir/a
b
Testing ./busybox hush
Test with find
dir
dir/a
b
Test with ls
dir/a
b
as you see, both busybox shells are compatible with bash in this regard.
--
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list