开发者

how can i concatenate {}* (star) to xargs and have it refer to it as the special character and not plain character?

I'm performing this

$ ls -l | awk '{print substr($9,substr1,11)}' | uniq | xargs -i ls {}*
ls: cannot access telneter.py*: No such file 开发者_C百科or directory
ls: cannot access telnetlib.p*: No such file or directory
ls: cannot access threading.p*: No such file or directory

I meant for it to search for files files* however it tells me that it cannot find the files because its actually looking for them with the actual * but i wanted to search for all files by * and not for files ending with *.

anyone can help with this please?

thanks


The * gets in too late to be interpreted by the shell. So, do it in a subshell.

ls -l | awk '{print substr($9,substr1,11)}' | uniq | xargs -i bash -c "ls {}*"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜