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?
14
u/udkyo Jul 10 '18 edited Jul 10 '18
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.
4
3
3
2
2
0
u/bestjejust Jul 10 '18
for i in ?
3
u/varesa Jul 10 '18
that's fine but if you need it a lot I think
lup operation @a,b@ @c,d@is much cleaner thanfor x in a b; do for y in c d; do operation $x $y; done; done1
u/bestjejust Jul 10 '18
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.
3
u/varesa Jul 10 '18
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
2
u/FakingItEveryDay Jul 10 '18
I agree with the spirit of what you're saying, but want to point out this can still be useful against servers where you don't install lup.
For example:
lup -t ping -c 1 @google,amazon@.@com,net@ | ssh serverlup will generate the commands locally to run on the server.
1
u/ecnahc515 Jul 10 '18
Yah or run in dry run locally, copy and paste on remote host. Or pipe the output to a script and scp the script over.
1
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