Correct, and the right way i might add on this specific part of the
script. You don't call basename often in my experience.

Sheepishly, My last e-mail was more of extending more information
rather than answering directly the question!

-- 
regards,
Andre | http://www.varon.ca

On Tue, Jun 3, 2008 at 4:40 AM, Mark David Dumlao <[EMAIL PROTECTED]> wrote:
> It's a shell script, not a C program.
>
> Unless you're writing a specifically low-level system utility (at which
> point you could do better by picking a lower level language), meant to be
> looped hundreds to thousands of times, the difference in using basename and
> the bash built-in is too small to be noticed. And even then your time
> reading the script is more likely to be more important than the system time
> consumed by basename.
>
> And if all else fails you can still use an alias or a environment variable
> to store your basename. Most people actually do it that way.
>
> BASENAME=`basename $0` #or BASENAME=${0##*/}
> ...
> while true; do
>  echo $BASENAME
>  #some code
> done
>
> and avoid the problem with basename being called too many times.
>
> I read somewhere "Programs are written to be read by people, and only
> incidentally be executed by computers."
>
> So I've always believed that
> ${0##*/} = generally bad
> using bash env variables and basename = generally good
>
> Don't discard good habits just because they give you a small performance
> gain!
>
> On Tue, Jun 3, 2008 at 8:31 AM, Ramil Galib <[EMAIL PROTECTED]> wrote:
>>
>> Thanks all,
>> I've been using basename $0 quite often until this one.
>> Thanks again.
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to