Re: Shell script cleanups/style changes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Schiele <rschiele@xxxxxxxxx> writes:

> No, you should read the mails you are refering to.  I said that the
> most important stuff does work.  Apparently this did not yet hurt me
> on the platform.

A non-working rebase would seem rather tough.

> Thus we have to decide whether we want some textbook example code
> and thus break this platform completely or whether we want to fix
> the issues you have listed and thus have a more portable
> application.

The "issues" are with Solaris, apparently.  There is always a price
for portability.  If Solaris users can fix their problems with a
global search and replace of the first line in *.sh, the question is
whether it is worth the hassle of having unreadable but "portable"
code.  After all, it has to be read also by humans.

>> Sure.  What about the git-rebase line using $(($end - $msgnum)) ?
>
> Bad on Solaris:
>
> $ uname -a
> SunOS solaris10-x64 5.10 Generic i86pc i386 i86pc
> $ end=1
> $ msgnum=5
> $ echo $(($end - $msgnum))
> syntax error: `(' unexpected
> $

You are missing the line
$ echo $0
which is probably the most interesting one...  we don't need to be
compatible with everything having a "$ " prompt, just with everything
called "/bin/sh".

>> Too bad: this should mean that $EDITOR can get called from C...  I've
>> been glad to see that so far this could be avoided.
>
> Why is it bad to call the editor from C?

See the rationale in my recently posted patch for implementing
EDITOR/VISUAL support.  One needs to shell-quote stuff properly, and
the shell is better at shell-quote magic than C is.

>> I do not think we have trouble with ${parameter#word}.  Much
>
> $ uname -a
> SunOS solaris10-x64 5.10 Generic i86pc i386 i86pc
> $ parameter=bla
> $ echo ${parameter#word}
> bad substitution
> $ 
>
>> less with ${parameter+word}; it has been in /bin/sh forever.
>
> That one is ok for Solaris.

If you prepare a patch replacing all existing ${parameter#word} uses
and get it accepted, I will not push for inclusion of my cleanup.

But you _really_ should go for it _now_.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux