# wolframscript output differs when code is stored in a file

I noticed that the output from wolframscript appears to be different when running interactively and when running with code in a file.

I tried searching for this, but it's a bit hard to describe, so I didn't find anything.

Here is an example of the interactive output, which looks normal to me.

$wolframscript Wolfram Language 12.1.0 Engine for Mac OS X x86 (64-bit) Copyright 1988-2020 Wolfram Research, Inc. In[1]:= Print[N[1/7,50]] 0.14285714285714285714285714285714285714285714285714  Here is the output when the code is in a file $ echo 'Print[N[1/7,50]]' > code && wolframscript -file code
0.1428571428571428571428571428571428571428571428571428571428571428571428571428550.


I don't understand where the suffix 28571428571428571428571428550. comes from and I don't know how to get rid of it.

It's because Print keeps the NumberMarks. Change your code to disable them:
Print[ToString[N[1/7, 50], NumberMarks -> False]]

• It seems that ToString by itself is sufficient, but thanks for mentioning that the extra substring was a number mark, because I didn't know what to call it. Jun 23, 2020 at 15:57