[PATCH] BBB: sd_setup.sh: Change /bin/bash -> /bin/sh to solely adhere to POSIX shell constructs

Jarielle Catbagan jcatbagan93 at gmail.com
Sun Jul 12 04:16:15 UTC 2015


Ok, I just sent a version 2 of the patch that included the change from
the previous version as well as changing all 'echo' invocations to
'printf'.  I tested the script both in bash/sh as well as dash, as
apparently sh can be a symbolic link to both on different platforms,
and things seem to be working.

Here is the link to the patch:
https://lists.rtems.org/pipermail/umon-devel/2015-July/000233.html

Let me know if there are still any issues or if we should look for an
alternative solution.

Thanks.

On Sat, Jul 11, 2015 at 6:48 PM, Jarielle Catbagan
<jcatbagan93 at gmail.com> wrote:
> Interesting. On my machine /bin/sh is a symbolic link to /bin/bash.  I
> went ahead and tried /bin/dash and the 'echo' command can interpret
> backslash characters whereas echo on sh/bash, -e has to be specified
> otherwise the characters are outputted as is.
>
> I tried printf in bash/sh and dash, and the command seems to be more
> compatible in both shells.  I think this would be the solution in that
> all 'echo' commands are replaced with 'printf'.  What do you think?
>
>
> On Sat, Jul 11, 2015 at 5:41 PM, Ed Sutter <edsutterjr at gmail.com> wrote:
>> For my system, with bash the "echo -e" is fine, but with sh, it chokes...
>>
>> els:ps
>>   PID TTY          TIME CMD
>>  3938 pts/24   00:00:00 bash
>>  3988 pts/24   00:00:00 ps
>> els:echo "hello\n1\n2\n3\n"
>> hello\n1\n2\n3\n
>> els:echo -e "hello\n1\n2\n3\n"
>> hello
>> 1
>> 2
>> 3
>>
>> els:exec /bin/sh
>> els:ps
>>   PID TTY          TIME CMD
>>  3938 pts/24   00:00:00 sh
>>  3991 pts/24   00:00:00 ps
>> els:echo "hello\n1\n2\n3\n"
>> hello
>> 1
>> 2
>> 3
>>
>> els:echo -e "hello\n1\n2\n3\n"
>> -e hello
>> 1
>> 2
>> 3
>>
>> els:
>>
>> Just noticed one other thing:
>>
>> els:ls -l /bin/sh
>> lrwxrwxrwx 1 root root 4 Feb 19  2014 /bin/sh -> dash
>> els:ls -l /bin/bash
>> -rwxr-xr-x 1 root root 986672 Oct  7  2014 /bin/bash
>>
>>
>> If you guys think my system is in a strange state; hence, I'm causing this
>> confusion, I'll just commit it as is.
>> Ed
>>
>> Hi Dr. Joel,
>>
>> On Sat, Jul 11, 2015 at 8:19 AM, Joel Sherrill
>> <joel.sherrill at oarcorp.com> wrote:
>>
>> On July 11, 2015 10:06:09 AM CDT, Jarielle Catbagan <jcatbagan93 at gmail.com>
>> wrote:
>>
>> Ed,
>>
>> Is there any indication as to why 'echo' is failing?  'echo' is not a
>> built-in command for either shell interpreter as I was able to locate
>> it as a separate program using both shells.  The -e option is to allow
>> interpretation of backslash characters as I was using it for newlines
>> and tabs.
>>
>> Do  sh -x and then try the command by hand at a prompt.
>>
>> Using sh -x, I issued
>>
>>         echo -e "test\t123"
>>
>> and it outputted
>>
>>         + echo -e 'test\t123'
>>         test        123
>>
>> On Sat, Jul 11, 2015 at 7:51 AM, Jarielle Catbagan
>> <jcatbagan93 at gmail.com> wrote:
>>
>> On Jul 11, 2015 7:17 AM, "Ed Sutter" <edsutterjr at gmail.com> wrote:
>>
>> Jarielle,
>> Did you try running the script with that change?
>> I applied the patch, then tried running it and it failed.
>> Apparently 'echo' in sh is different than 'echo' in bash, at least
>>
>> it is
>>
>> for my system.
>> Let me know.
>> I had to remove the -e from the echo lines for it to work on my
>> ubuntu14.04 system.
>> You wanna test that and resubmit the patch or should I do it?
>> Ed
>>
>> Hi Ed,
>>
>> After I changed it to 'sh' I was able to run it.  Ok, I'll look into
>>
>> it to
>>
>> see what the issue might be.
>> _______________________________________________
>>
>> umon-devel mailing list
>> umon-devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/umon-devel
>>
>> _______________________________________________
>> umon-devel mailing list
>> umon-devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/umon-devel
>>
>> --joel
>>
>>
>>
>> _______________________________________________
>> umon-devel mailing list
>> umon-devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/umon-devel



More information about the umon-devel mailing list