The second form you mention should work. Use "M2 --help" to find out
what the possibilities are. Another way is "M2 <file". If those
possibilities don't work for you, email to me privately the output
that appears on the screen so I can see why you think you had no
success.
Example:
thallium$ echo 'print 100!' > bar.m2
thallium$ M2 bar.m2
Macaulay2, version 1.3.1
with packages: ConwayPolynomials, Elimination, IntegralClosure,
LLLBases, PrimaryDecomposition, ReesAlgebra, SchurRings, TangentCone
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
i1 :
thallium$