let's say ls retunrs file1 file2 dir1 dire2 ..., I want to print you have file1 file2 dir1 dire2 ... in currnent folder.
How can I do that?
ls | xargs -i echo 'you have {} in current folder' prints
you have file1 in current folder you have file2 in current folder you have dir1 in current folder you have dir2 in current folder you have xxx in current folder
also, I have tried
ls |xargs printf 'you have %s %s %s %s in current folder'
but couldn't make it work. as the number of files is indefinite. what is the right syntax for printf in this case?
ls | xargs printf 'you have $@ in current folder' is the closest I can get, but it doesn't work.