sysfs output without newlines
Andy Shevchenko
andy.shevchenko at gmail.com
Wed Sep 2 03:57:36 EDT 2020
On Wed, Sep 2, 2020 at 1:24 AM Pete Zaitcev <zaitcev at redhat.com> wrote:
>
> 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.
There are still a lot of scripts in PHP and Perl. Besides that I think
the many users of such files are in clouds, means Go should be checked
even before these.
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list