all about xargs ! (beginner - intermediate) anthony explains
ฝัง
- เผยแพร่เมื่อ 7 ม.ค. 2021
- xargs is by far one of the most useful commandline tools I know -- I teach the main things you need to use it so you can look like a commandline wizard too!
- ^D: • protip: exiting really...
playlist: • anthony explains
==========
twitch: / anthonywritescode
dicsord: / discord
twitter: / codewithanthony
github: github.com/asottile
stream github: github.com/anthonywritescode
I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below! - วิทยาศาสตร์และเทคโนโลยี
ok this was pretty cool. I just started looking into bash scripting, and I'm definitely going to look into find and xargs (and git) a lot more
Note that the '-1' is unnecessary for ls. ls detects whether its output is going to a terminal, or if it's being piped to another program. If it's being piped to another program, like xargs, it only outputs one entry per line. So the command "ls -1 | xargs -d'
' --verbose -n1" does the same thing even if you remove the '-1'.
this depends on the implementation and version of `ls` -- not all implementations behave in that way
episode 200!! super cool i really like these. also what a great topic for #200 i LOVE xargs
Dang, this is a lot of cool stuff. I've used xargs whenever I needed too, but never delved that deeply into it. This workflow is really nice.
And here I was using $() subprocess substitution like a pleb, e.g. something like `echo $(ls)` or `for file in $(ls)`. xarrgs seems like the better option for most of those cases and I'll be happy to use it from now on :)
xargs is indeed the Linux key to doing many bits of automation. Great code coaching.
Another gem of a video ! Thanks !
thank you!
Didn't agree more, find + xargs is the way to go, for long commands i usually add a tqdm at the end too.
5:29 how did you jump from EOL to that position (position before 'hello') so quickly?
probably Ctrl+e
i still didn't get it 😥. i am very new to linux
What part of the quoting you "didn't do properly"?
I keep re-reading it, but I don't understand why it manages to rename 'hello hello world' into a bak file and then tries to move a world file...
spaces in filenames got interpreted as argument separators. quoting properly prevents that
learning xargs because I can't learn how to use variables on scripting.. hahahaha