Re: [Slackbuilds-users] bashisms?

2015-09-12 Thread Andrzej Telszewski
Hi, I'm sorry to bother you again, it's not a bashism, but I thought I'll share my finding with you. I have never read my shell's manual (probably applies to all the shells) and I was shocked by this behavior, particularly because I spent couple of hours debugging my script. I should have

Re: [Slackbuilds-users] bashisms?

2015-09-02 Thread Andrzej Telszewski
On 02/09/15 16:51, John Vogel wrote: On Wed, 2 Sep 2015 15:52:30 +0200 Andrzej Telszewski wrote: Hi, Today I was writing code to execute script from C code and I'd like to share with you what I've found. It stroke me, but should otherwise be obvious. It seems that

Re: [Slackbuilds-users] bashisms?

2015-09-02 Thread John Vogel
On Wed, 2 Sep 2015 17:09:45 +0200 Andrzej Telszewski wrote: > On 02/09/15 16:51, John Vogel wrote: > > On Wed, 2 Sep 2015 15:52:30 +0200 > > Andrzej Telszewski wrote: > > > >> Hi, > >> > >> Today I was writing code to execute script from C code and

Re: [Slackbuilds-users] bashisms?

2015-09-02 Thread Andrzej Telszewski
On 02/09/15 17:13, John Vogel wrote: On Wed, 2 Sep 2015 17:09:45 +0200 Andrzej Telszewski wrote: On 02/09/15 16:51, John Vogel wrote: On Wed, 2 Sep 2015 15:52:30 +0200 Andrzej Telszewski wrote: Hi, Today I was writing code to execute script

Re: [Slackbuilds-users] bashisms?

2015-09-02 Thread B Watson
On 9/2/15, Andrzej Telszewski wrote: > taking into account the shebang (maybe there are shells, that upon > seeing shebang in the first line don't treat it as comment, but I don't > know about it). It's not a shell, but perl does this: $ cat 1.sh #!/bin/sh echo "Hello

Re: [Slackbuilds-users] bashisms?

2015-09-02 Thread Andrzej Telszewski
Hi, Today I was writing code to execute script from C code and I'd like to share with you what I've found. It stroke me, but should otherwise be obvious. It seems that shebang has only meaning if the script is invoked directly, that is: $ ./whatever.SlackBuild or $ sh -c

Re: [Slackbuilds-users] bashisms?

2015-09-02 Thread John Vogel
On Wed, 2 Sep 2015 15:52:30 +0200 Andrzej Telszewski wrote: > Hi, > > Today I was writing code to execute script from C code and I'd like to > share with you what I've found. It stroke me, but should otherwise be > obvious. > > It seems that shebang has only meaning if

Re: [Slackbuilds-users] bashisms?

2015-08-29 Thread B Watson
On 8/28/15, Jim Diamond jim.diam...@acadiau.ca wrote: and otherwise following good programming practices by explicitly declaring that the shell script must be run by bash if that is, indeed, the case). I tried doing that, it got changed back to #!/bin/sh, so I just gave up. I don't use other

Re: [Slackbuilds-users] bashisms?

2015-08-29 Thread Didier Spaier
On 29/08/2015 10:16, B Watson wrote: On 8/28/15, Jim Diamond jim.diam...@acadiau.ca wrote: and otherwise following good programming practices by explicitly declaring that the shell script must be run by bash if that is, indeed, the case). I fully agree to what Jim wrote. I tried doing

Re: [Slackbuilds-users] bashisms?

2015-08-29 Thread Ozan Türkyılmaz
2015-08-29 14:32 GMT+05:00 Didier Spaier did...@slint.fr: On 29/08/2015 10:16, B Watson wrote: For anyone reading, some stuff that may help. chechkbashims is provided here: http://slackbuilds.org/repository/14.1/development/checkbashisms/ See also: http://mywiki.wooledge.org/Bashism In

Re: [Slackbuilds-users] bashisms?

2015-08-29 Thread Jim Diamond
On Sat, Aug 29, 2015 at 04:16 (-0400), B Watson wrote: On 8/28/15, Jim Diamond jim.diam...@acadiau.ca wrote: and otherwise following good programming practices by explicitly declaring that the shell script must be run by bash if that is, indeed, the case). I tried doing that, it got

Re: [Slackbuilds-users] bashisms?

2015-08-29 Thread Jim Diamond
On Sat, Aug 29, 2015 at 11:25 (-0400), B Watson wrote: On 8/29/15, Jim Diamond jim.diam...@acadiau.ca wrote: it'd be easy enough to sed the shebangs to #!/bin/bash Well, this is, I believe, something which is also wrong in principle. In general, you're right. For the specific case of

Re: [Slackbuilds-users] bashisms?

2015-08-29 Thread B Watson
On 8/29/15, Jim Diamond jim.diam...@acadiau.ca wrote: it'd be easy enough to sed the shebangs to #!/bin/bash Well, this is, I believe, something which is also wrong in principle. In general, you're right. For the specific case of Slackbuilds, they're all already bash scripts (since /bin/sh is

Re: [Slackbuilds-users] bashisms?

2015-08-29 Thread B Watson
On 8/29/15, Jim Diamond jim.diam...@acadiau.ca wrote: There are slight differences when bash is run as sh rather than bash, but they only have to do with which startup files are read (see INVOCATION section in man page). You are wrong on this last point (according to the bash man page).

Re: [Slackbuilds-users] bashisms?

2015-08-28 Thread Jim Diamond
On Thu, Aug 27, 2015 at 21:28 (+0200), Didier Spaier wrote: On 27/08/2015 18:45, B Watson wrote: Are we supposed to be avoiding bashisms? I don't know, but I tend to. We can't rule out that a folk running a SlackBuild have symlinked /bin/sh to /bin/ash, and replaced the #!/bin/sh shebang

Re: [Slackbuilds-users] bashisms?

2015-08-27 Thread David Spencer
I used to use bashisms, and put #!/bin/bash at the top of my slackbuilds. In every case, someone on the SBo team changed the shebang to #!/bin/sh but left the bashisms in place. Me too - I used to use bashisms, and put #!/bin/bash at the top of my slackbuilds. In every case, someone on the SBo

[Slackbuilds-users] bashisms?

2015-08-27 Thread B Watson
From the remmina thread: On 8/27/15, David Spencer baildon.resea...@googlemail.com wrote: Seeing as we mentioned remmina... the tarball extraction is broken, and there's a bashism too. (sorry for the nitpick) Are we supposed to be avoiding bashisms? I used to use bashisms, and put

Re: [Slackbuilds-users] bashisms?

2015-08-27 Thread B Watson
On 8/27/15, David Spencer baildon.resea...@googlemail.com wrote: In every case, someone on the SBo team has found a better way of doing it that didn't need bash. Mine got their #!/bin/bash changed to #!/bin/sh, but their bashisms are still there. Maybe a few of them got changed (maybe even

Re: [Slackbuilds-users] bashisms?

2015-08-27 Thread Didier Spaier
On 27/08/2015 18:45, B Watson wrote: Are we supposed to be avoiding bashisms? I don't know, but I tend to. We can't rule out that a folk running a SlackBuild have symlinked /bin/sh to /bin/ash, and replaced the #!/bin/sh shebang by #!/bin/bash in scripts that must run on bash (or even modified