yus’s code also worked for me in bash.
Here is another way: since the output line looks like this (int) 3
you can look for this line and then print the 3 (second field in the line):
Note that we are immediately filtering the output through grep, so in more complex examples you may see stuff you don’t want (if there are other (int) lines) or may not see other stuff you want (if there are other outputs), so you will have to modify accordingly.
Also note that, in either case, you can (but don’t need to) pass to root the “-l” option to avoid the ‘splash screen’.