sysfs output without newlines

Pete Zaitcev zaitcev at redhat.com
Tue Sep 1 18:22:30 EDT 2020


On Tue, 1 Sep 2020 09:07:42 +0000
David Laight <David.Laight at ACULAB.COM> wrote:

> The shell will remove trailing '\n' (but not '\r') from:
> 	foo=$(cat bar)
> So shell scripts are unlikely to be affected.

Surprisingly enough, Python is okay with this:

    with open("/proc/sys/net/ipv4/ip_forward",'r') as fp:
        print(int(fp.read()))

Nonetheless, I would rather no add those newlines. I saw enough
weird software that is sensitive where it's should not bee.

-- Pete




More information about the linux-arm-kernel mailing list