[systemd-devel] Counting mechanism in udev rules

Robert Milasan rmilasan at suse.com
Fri Dec 14 00:11:06 PST 2012


Is there some kind of a counting mechanism which can be used in a udev
rule?

I got this rule:

ACTION=="add", SUBSYSTEM=="3270", KERNEL=="tty0.0.[0-9]*",
SYMLINK+="3270/ttycons-%n"

and the result of this rule looks like this:

lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons-0500 -> ../tty0.0.0500
lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons-0501 -> ../tty0.0.0501
lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons-0502 -> ../tty0.0.0502
lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons-0503 -> ../tty0.0.0503

But I would like instead of '%n' to use a counting variable that would
make the result look something like this:

lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons0 -> ../tty0.0.0500
lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons1 -> ../tty0.0.0501
lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons2 -> ../tty0.0.0502
lrwxrwxrwx 1 root root 14 Dec 13 15:28 ttycons3 -> ../tty0.0.0503

Would this be possible in udev, if so what '%' option can I use?

-- 
Robert Milasan

L3 Support Engineer
SUSE Linux (http://www.suse.com)
email: rmilasan at suse.com
GPG fingerprint: B6FE F4A8 0FA3 3040 3402  6FE7 2F64 167C 1909 6D1A


More information about the systemd-devel mailing list