I want do a batch job with systemctl, something like:
systemctl status v2ray-haproxy@{1..5}
That's fine. But when i change 5 to a variable:
n=5;systemctl status v2ray-haproxy@{1..$n}
It's not working now, and error:
Invalid unit name "v2ray-haproxy@{1..5}" was escaped as "v2ray-haproxy@\x7b1..5\x7d" (maybe you should use systemd-escape?) Unit v2ray-haproxy@\x7b1..5\x7d.service could not be found.
How to get this variable code work?
try something like below