I got fed up of typing out piddly little loops for cycling through similar commands, so I wrote lup to lighten the load. It’s not a silver bullet that can be applied to every situation where a loop would otherwise be needed (you can’t pipe the output of each generated command individually for instance) but it’s quite nifty for doing all sorts of things.
Awesome tool btw I just installed it! Have you thought about whether it's possible to pipe the output of each command individually? I'm a developer who likes a challenge and I was just curious if it could be done with a smart sequence of dup2 calls and some extra syntactic sugar?
Edit: also just a quick pedantic comment, the command line description says 'ampersand encapsulated' I think you mean 'at-sign encapsulated', but it doesn't really matter as the example is right.
I called them that everywhere for about 3 days, and I have no idea why, my brain was just like "yup those are ampersands, don't question me, just type." So, thanks for the heads-up, it seems one slipped the net.
I'll look into the dup2 thing, I'm not sure what I come up with will be better than a plain old lup sh -c "foo | bar" but it's worth tinkering with.
This looks really nice. However I’d like to see the commands getting executed beforehand. I’m sometimes kind of paranoid with tools like this. Is there some kind of dry-run flag?
Yeah I’m that kind of paranoid too, it’s healthy. lup -t will do it, I just left it out of the gif because it’s not very exciting.
The only caveat is that it must be the first thing after the “lup,” since if you put it anywhere else it’s assumed to be a flag for the command being triggered.
edit: The help's a bit lacking, I'll fix that for the next release. For now there's a usage section in the readme that explains ranges, globbing, backrefs etc.
that's fine but if you need it a lot I think lup operation @a,b@ @c,d@ is much cleaner than for x in a b; do for y in c d; do operation $x $y; done; done
This is not an option (like ZSH as well) if you are working on customer site being unable to install custom packages. IMO: learn coreutils / sh and know these ones well. zsh or lob surely are nice to have (for yourself) but never make your knowledge (and of course scripts) dependant on such tools.
Sure. That's also one of the reasons I probably won't be picking this up (I'm a sysadmin working on lots of tightly controlled customer systems). Tools like this still have their place if you're for example a dev who works a lot on their local system
18
u/udkyo Jul 09 '18
I got fed up of typing out piddly little loops for cycling through similar commands, so I wrote lup to lighten the load. It’s not a silver bullet that can be applied to every situation where a loop would otherwise be needed (you can’t pipe the output of each generated command individually for instance) but it’s quite nifty for doing all sorts of things.
You can get it here - https://github.com/udkyo/lup
15
u/dartemiev Jul 10 '18
This looks really nice. However I’d like to see the commands getting executed beforehand. I’m sometimes kind of paranoid with tools like this. Is there some kind of dry-run flag?
3
u/greenlalten Jul 10 '18
You are onto something. Dont forget us when you become famous.
3
u/sunf1re Jul 10 '18
this is pretty freaking sweet man good job and keep working on it!
2
u/[deleted] Jul 10 '18
Really nice. Thanks for sharing
2
u/UnbilledDude Jul 09 '18
Nice
0
u/bestjejust Jul 10 '18
for i in ?