Run "yes 0 | script -c 'ispell text.txt' /dev/null" on Mac OS X

401 Views Asked by At

I am getting crazy, on my Linux machine I would run:

yes 0 | script -c 'ispell text.txt' /dev/null

With any problem. Unfortunately on Mac OS X the command script is not accepting the '-c' option:

script: illegal option -- c

I installed with brew: binutils, coreutils and other packages .. but there is no script or script alternative command anywhere.

I found on Google that the package under Linux is util-linux: https://www.kernel.org/pub/linux/utils/util-linux/

But there is no way to find it for mac OS X nor in a compiled package nor in brew source.

Could anyone please point me to the right direction?

PS: my final aim is to achieve this: Spell checking a file using command line, non-interactively

1

There are 1 best solutions below

1
Andreas Louv On

If the command script doesn't support a -c flag one can then you to add the command as stdin:

echo 'ispell text.txt' | script /dev/null

But looking at that command it seems like you are using it wrong as the output file is /dev/null.

Instead use:

bash -c 'ispell text.txt'

Or even:

ispell text.txt