lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 10.12.2017 11:09, Mason Mackaman wrote:
Yep this fixes it! much better than my solution of writing it to a file and then executing it XD. How can I change it to execute through Bash by default?

Try
    os.execute'bash -c "echo -n text ... "'

or link /bin/sh to /bin/bash, which makes it permanent.

- Bernd

On 10Dec, 2017, at 04:39, Douglas J Davenport <puzzlery@lightlink.com> wrote:


On 2017-Dec-10, at 3:46 AM, Mason Mackaman <masondeanm@aol.com> wrote:

When I run this command in my Bash shell, the output I get is "-n text". Is this a bug or am I messing up something simple? I've never encountered this problem with os.execute before .

Most likely the shell used to evaluate the parameters to the system() call does not support the -n option. Try:

   /bin/sh -c ‘echo -n “text”'

vs.

   /bin/bash -c ‘echo -n “text”’

I get “-n text” as output to the first command and “text” to the second.

On most systems Lua will had the os.execute() parameter to /bin/sh for processing as that is the behavior of the system() call.

-djd