On Sat, Dec 06, 2008 at 11:42:38PM +0200, Dotan Cohen wrote:
> 2008/12/6 Tzafrir Cohen <tzafrir@cohens.org.il>:
> > This is bashism.
> >
>
> That is why we call it "bash"!
>
> > #!/bin/sh
> > LC_ALL="" LC_TIME="en_DK.utf8" /usr/bin/thunderbird "$@"
> >
> > Or even better:
> >
> > #!/bin/sh
> > LC_ALL="" LC_TIME="en_DK.utf8" exec /usr/bin/thunderbird "$@"
> >
>
> I could probably google and find out why the semicolons are not
> necessary,
VAR="value" command
will run 'command' with the variable VAR set to "value".
This is why you get a strange error with the following:
VAR=value with spaces
It will complain about trying to run the command 'with spaces' (or
rather: command 'with' with parameter 'spaces').
> nor the export command, but why is the "exec" preferable?
exec (like all the exec* system calls) replace the current process.
Try an 'strace -f' following script:
#!/bin/sh
exec /bin/true
which will show you that no forking was done, vs:
#!/bin/sh
/bin/true
Which runs /bin/true in a sub process, waits for it to exit and only
then exist.
--
Tzafrir Cohen | tzafrir@jabber.org | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir@cohens.org.il | | best
ICQ# 16849754 | | friend
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
12-06-2008, 08:59 PM
Ken Irving
Bashism (Was: Locale testing)
On Sat, Dec 06, 2008 at 11:42:38PM +0200, Dotan Cohen wrote:
> 2008/12/6 Tzafrir Cohen <tzafrir@cohens.org.il>:
> > This is bashism.
> >
>
> That is why we call it "bash"!
>
> > #!/bin/sh
> > LC_ALL="" LC_TIME="en_DK.utf8" /usr/bin/thunderbird "$@"
> >
> > Or even better:
> >
> > #!/bin/sh
> > LC_ALL="" LC_TIME="en_DK.utf8" exec /usr/bin/thunderbird "$@"
> >
>
> I could probably google and find out why the semicolons are not
> necessary, nor the export command, but why is the "exec" preferable?
Probably just because it doesn't leave the wrapper script as a
process to be returned to after you're done with thunderbird.
Ken
--
Ken Irving
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
12-06-2008, 09:08 PM
"Boyd Stephen Smith Jr."
Bashism (Was: Locale testing)
On Saturday 06 December 2008, "Dotan Cohen" <dotancohen@gmail.com> wrote
about 'Bashism (Was: Locale testing)':
>I could probably google and find out why the semicolons are not
>necessary, nor the export command, but why is the "exec" preferable?
That way the thunderbird process replaces the shell process rather than the
shell process simply waiting around for the thunderbird process to die and
then dieing itself.
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss03@volumehost.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.org/ \_/
12-06-2008, 09:33 PM
"Dotan Cohen"
Bashism (Was: Locale testing)
2008/12/6 Tzafrir Cohen <tzafrir@cohens.org.il>:
> VAR="value" command
>
> will run 'command' with the variable VAR set to "value".
>
> This is why you get a strange error with the following:
>
> VAR=value with spaces
>
> It will complain about trying to run the command 'with spaces' (or
> rather: command 'with' with parameter 'spaces').
>
>> nor the export command, but why is the "exec" preferable?
>
> exec (like all the exec* system calls) replace the current process.
>
> Try an 'strace -f' following script:
>
> #!/bin/sh
> exec /bin/true
>
> which will show you that no forking was done, vs:
>
> #!/bin/sh
> /bin/true
>
> Which runs /bin/true in a sub process, waits for it to exit and only
> then exist.
>
For maximum compatibility, that needs to be:
VAR=<value>; export VAR
Standard "export" doesn't handle setting the value of the variable, it
*only* marks the variable as exported.
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss03@volumehost.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.org/ \_/
12-06-2008, 10:47 PM
"Dotan Cohen"
bashism (was: Locale testing)
2008/12/7 Boyd Stephen Smith Jr. <bss03@volumehost.net>:
> For maximum compatibility, that needs to be:
> VAR=<value>; export VAR
>
On Sat, Dec 6, 2008 at 15:47, Dotan Cohen <dotancohen@gmail.com> wrote:
> 2008/12/7 Boyd Stephen Smith Jr. <bss03@volumehost.net>:
>> For maximum compatibility, that needs to be:
>> VAR=<value>; export VAR
>>
>
> Compatibility with what?
sh, ash, dash, zsh, pdksh, etc.
Cheers,
Kelly Clowers
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
12-07-2008, 12:04 AM
"Boyd Stephen Smith Jr."
bashism (was: Locale testing)
On Saturday 2008 December 06 17:47, Dotan Cohen wrote:
> 2008/12/7 Boyd Stephen Smith Jr. <bss03@volumehost.net>:
> > For maximum compatibility, that needs to be:
> > VAR=<value>; export VAR
>
> Compatibility with what?
UNIX. The Single Unix Specification is maintained by the Open Group who
certify UNIX products.
In particular, Mac OS X is certified UNIX.
--
Boyd Stephen Smith Jr. * * * * * * * * * * ,= ,-_-. =.
bss03@volumehost.net * * * * * * * * * * *((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy * * * * * `-'(. .)`-'
http://iguanasuicide.org/ * * * * * * * * * * *\_/ * *
12-07-2008, 09:42 AM
Tzafrir Cohen
bashism (was: Locale testing)
On Sun, Dec 07, 2008 at 01:47:29AM +0200, Dotan Cohen wrote:
> 2008/12/7 Boyd Stephen Smith Jr. <bss03@volumehost.net>:
> > For maximum compatibility, that needs to be:
> > VAR=<value>; export VAR
> >
>
> Compatibility with what?