Cleaner ID parsing

Hi,

I am currently writing a script for automatically cleaning out expired user-manager accounts. Using version 3.x by the way.

So far so good, but there’s one thing that’s bugging and I hope someone here can help. The question is generic scripting related, not user-manager specifically.

I’m doing a lot of looping to cycle through accounts, therefore I’m using quite a number of get .

Unfortunately when trying it on terminal, I have to dump a “print without-paging” before the account list gets any ID attached to it. Unless I print before, get simply refuses to work. Now this would be fine with a small list, but having to dump 4000+ users is a bit lengthy, annoying, and in my eyes, silly.

Is there a cleaner way to do it? Maybe I have the whole ID theory wrong. Someone with more insight would be of great help.

As I said I’m trying it on terminal .. don’t know if the print thing is needed when running the script automatically.

Input appreciated, as I’m always striving for clean, simple code.

my advice would be to look API way. And these IDs in console, they are created only when you have done that print of the list.

Pity.

Thanks for the clear reply though.

on the bright side - API has .id field that does not change ever for static entries on the router. So if you add user you get .id returned, and you can save it and use later on, as long as the entry you added is present on the router.

I discovered however that even if you’re working on a script that runs automatically, and you’re not watching in console, the print function does its job, so it’s not really a problem.

I just opted for “print brief without-paging” :slight_smile: