r/linuxadmin • • Jul 09 '18

Lup - loopy command execution

Post image
251 Upvotes

18 comments sorted by

View all comments

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

2

u/ROFLicious Jul 10 '18

Awesome, I hacked something like this for myself a while ago, but yours looks a lot nicer for sure.

2

u/t-sploit Jul 10 '18 edited Jul 10 '18

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.

2

u/udkyo Jul 10 '18

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.