[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: os.execute(echo -n "text") error
- From: Bernd Eggink <monoped@...>
- Date: Sun, 10 Dec 2017 11:51:44 +0100
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?
os.execute'bash -c "echo -n text ... "'
or link /bin/sh to /bin/bash, which makes it permanent.
On 10Dec, 2017, at 04:39, Douglas J Davenport <email@example.com> wrote:
On 2017-Dec-10, at 3:46 AM, Mason Mackaman <firstname.lastname@example.org> 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”'
/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.