[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: os.execute(echo -n "text") error
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 10 Dec 2017 11:49:48 +0200
Thanks Douglas, you have hit the nail on the head.
On Ubuntu 16.04 /bin/sh is a link to /bin/dash, which does recognize -n.
2017-12-10 11:39 GMT+02:00 Douglas J Davenport <puzzlery@lightlink.com>:
>
>> 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
>
>
>