hello, why can't the xargs's intial-arguments which are passed to any command expanded?
First I Can list the file with a wild expansion.
Code:
virteman@ubuntu:/tmp$ ls -l tmp*
-rw------- 1 root root 0 2009-03-21 18:50 tmp.yWkOcZ6220
Second I echo the wild expansion pipe to xargs and then list it. But the exception occur to here.
Code:
virteman@ubuntu:/tmp$ echo 'tmp*' |xargs -t ls -l
ls -l tmp*
ls: cannot access tmp*: No such file or directory
Then I add bash -c to the list command , And it seams OK.
Code:
virteman@ubuntu:/tmp$ echo 'tmp*' |xargs -t -I{} bash -c 'ls -l {}'
bash -c ls -l tmp*
-rw------- 1 root root 0 2009-03-21 18:50 tmp.yWkOcZ6220
I want to know why I cannot use the second command?