I've never been confident using xargs and often get unintended results. Many of the videos I've watched on it have somewhat added to my confusion and the examples relied on tend to be lazy. This video has helped, in part because you voice the meaning of each part of the command as you type it. I do the same but now find some of my assumptions were not correct because I was voicing the wrong words. It'll take me a while to confidently use xargs but this one has set me on the right road. The -t flag will be very useful to me too. Thanks.
There is an issue with your command at 5:09. Even though you added the -0 flag, `ls` doesn't know about that and directories/files with single or double quotation marks won't be parsed correctly. (e.g. mkdir -p '12" records'; ls | xargs -0 -I {} rmdir {} -> rmdir: failed to remove '12" records'$' ': No such file or directory). As an alternative to `ls`, use find . -print0 | xargs -0 or populate an array and loop over its values `arr=(*); for file in "${arr[@]}"; ... ` . As a third option, xargs -d ' ' will split your input correctly, but it will break with potentially malicious filenames as those can include newlines.
5:46 - $ ls | xargs -n1 -I {} echo is a directory: {} 1>/dev/null xargs: warning: options --max-args and --replace/-I/-i are mutually exclusive, ignoring previous --max-args value
I've never been confident using xargs and often get unintended results. Many of the videos I've watched on it have somewhat added to my confusion and the examples relied on tend to be lazy. This video has helped, in part because you voice the meaning of each part of the command as you type it. I do the same but now find some of my assumptions were not correct because I was voicing the wrong words. It'll take me a while to confidently use xargs but this one has set me on the right road. The -t flag will be very useful to me too. Thanks.
I used to struggle with xargs. Wish I had this video back then.
You are doing great service sir.
You are a great teatcher .Thanks !!
I feel this is not said enough- love these videos!
That's an excellent treatment.
Many thanks, I learned a lot from your channel.
AWESOME session on xargs.....
There is an issue with your command at 5:09. Even though you added the -0 flag, `ls` doesn't know about that and directories/files with single or double quotation marks won't be parsed correctly. (e.g. mkdir -p '12" records'; ls | xargs -0 -I {} rmdir {} -> rmdir: failed to remove '12" records'$'
': No such file or directory). As an alternative to `ls`, use find . -print0 | xargs -0 or populate an array and loop over its values `arr=(*); for file in "${arr[@]}"; ... ` . As a third option, xargs -d '
' will split your input correctly, but it will break with potentially malicious filenames as those can include newlines.
Very much appreciate you and your videos.
Thank you sir! Love your videos!
Great....as always.
I've never used xargs for any of these particular use cases. I've always used a combination of for, sed, awk, etc.
same, this is going to help me a lot
love your videos sir. can you teach me software engineering.
5:46 - $ ls | xargs -n1 -I {} echo is a directory: {} 1>/dev/null
xargs: warning: options --max-args and --replace/-I/-i are mutually exclusive, ignoring previous --max-args value