Re: Need help correcting this Bash function
From: Ed Morton (morton_at_lsupcaemnt.com)
Date: 10/09/04
- Next message: William Park: "Re: Need help correcting this Bash function"
- Previous message: Chris F.A. Johnson: "Re: Need help correcting this Bash function"
- In reply to: Tavis Ormandy: "Re: Need help correcting this Bash function"
- Next in thread: Tavis Ormandy: "Re: Need help correcting this Bash function"
- Reply: Tavis Ormandy: "Re: Need help correcting this Bash function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 09 Oct 2004 09:07:34 -0500
Tavis Ormandy wrote:
> On 2004-10-09, Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
>
>>>Re-read the thread, I was asking why is it necessary to add extra code
>>
>> Who said anything about adding extra code?
>
>
> What do you think we are discussing here?
He appears to think, as I do, that we're discussing whether or not to
use bash-sepcific constructs when the equivalent generally-available
constructs could be used for about the same amount of code and
efficiency. If that's not what's being discussed, please enlighten us!
>
>>>so that some antiquated implementations don't get confused in some rare
>>>situation that is never going to happen anyway, as he's WRITING A BASH
>>>SCRIPT.
>>
>> Why is it better to write a bash script than a script that runs
>> equally well in bash, ksh, ash, and other POSIX shells?
>>
>
>
> Stop. Read Thread. Think.
>
> You seem to think I'm advocating non-portability. I'm saying why should
> exta code be added to my conditions to support antiquated, broken
> shells? _especially_ as this script is a bash script.
Because there are plenty of people out there running ksh88 and other
older shells. I use ksh88 because I often have to run scripts on
machines that don't have bash or other more recent shells installed and,
since I don't own or administer those machines, I don't want to waste my
time installing them or correcting my scripts for the brief period when
I'm using those machines.
As for the OP asking for help with a "bash script" - that doesn't mean
he wants or should only get a bash-specific solution. Plenty of people
post questions here about one tool only to be told that either:
a) they're using the tool the wrong way, or
b) the correct solution is to use a different tool.
>
>>>> Pattern matching is available with case; [[..]] is not necessary (I
>>>> have NEVER used it in a script).
>>>
>>>Well, your scripts must be needlessly complex and long.
>>
>> No, they are usually not any longer than a less portable script.
>
>
> Well then, you're lucky that you only ever have to do simple operations.
I very much doubt that's the case, but I suspect that most people would
use awk or perl for most complex operations anyway.
<snip>
> So...what is your point?
>
> a) Everyone should write 100% POSIX sh compliant code.
> b) Everyone should write 100% POSIX sh compliant code, unless it's easier not to.
I believe it's:
c) Everyone should write 100% POSIX sh compliant code, unless it's
significantly beneficial not to.
I do use gawk instead of old awk. That means I couldn't run my awk
scripts on some of those older machines I mentioned BUT there's such a
huge difference in capabilities between gawk and old awk that it's worth
it in that case and I never actually have had to use a gawk script on
one of the older machines anyway since I could just ship the data files
to a newer machine, run gawk, and ship the results back. This falls into
"c" above - it's significantly beneficial to use gawk over oawk so I do
it. In the shell cases we're discussing there's little or no benefit so
I can't imagine why you'd do it.
Ed.
- Next message: William Park: "Re: Need help correcting this Bash function"
- Previous message: Chris F.A. Johnson: "Re: Need help correcting this Bash function"
- In reply to: Tavis Ormandy: "Re: Need help correcting this Bash function"
- Next in thread: Tavis Ormandy: "Re: Need help correcting this Bash function"
- Reply: Tavis Ormandy: "Re: Need help correcting this Bash function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|