From: no.top.post on
In article <7q97rpFl8eU1(a)mid.individual.net>, "Chris F.A. Johnson" <cfajohnson(a)gmail.com> wrote:
--snip --
> >> > How would I start coding this?
> >>
> >> My recommendation would be to put your phrases in a file like boj.data
> >>
> > IMO on advantage of objectifying is that the data and its operator/s
> > are together. The vehicle is never separated/lost from its driver.
> > I don't want extra files to be created if possible.
>
> So you want to bloat all the files with the same code in each?

Yes, each vehicle has got its own attatched driver.
Not like my real-life nightmare where I've got to fetch my single
flashlite from location B or C to use at location A.
Interesting how OOD used inheritance to be more economical.
My computing system 'postpones the common sharing for economy'
to a very low-level: all jobs use the single/same CPU to eg. clear AX.

I want to economise MY EFFORT, not file space.

> What happens when you need to modify the code? You have to edit it
> in multiple places.

This is an important consideration, which hopefully factoring and
indirection would handle. So we're back to the 1950's concepts ?

> If each file is written as a script, you could do it by sourcing
> the code in each file:
>
> data=(
> ....
> ....
> )
> source /path/to/script

I don't understand this, but it may be related to a recent optimisation:
I'd evolved [by adding entries] a script m:
echo ' g1277 <URL-list> <accumFetces>'
echo ' <next command explanation I...>
....
echo ' <next command explanation N...>

So then I exercise the new-bash-trick that I'd just learned to:
'm > mOptinised'
And edited mOptinised to bracket the contents in: 'cat << EOF'
<the file>
EOF
But such cute optimisations don't increase my productivety much.

I waste hours looking at bash code to try to simply:--
Read(LineNumber)
Write(LineNumber,ofFileX)
---
And absurdly end up using awk inside bash !
Even 'sed' seems a fraud, since the tutor-writters who just
copy each other, tell what: 'sed 5q' and 'sed <all but line5>
does. But NOT <print line 5 only>.


From: Chris F.A. Johnson on
On 2010-01-04, no.top.post(a)gmail.com wrote:
> In article <7q97rpFl8eU1(a)mid.individual.net>, "Chris F.A. Johnson" <cfajohnson(a)gmail.com> wrote:
> --snip --
>> >> > How would I start coding this?
>> >>
>> >> My recommendation would be to put your phrases in a file like boj.data
>> >>
>> > IMO on advantage of objectifying is that the data and its operator/s
>> > are together. The vehicle is never separated/lost from its driver.
>> > I don't want extra files to be created if possible.
>>
>> So you want to bloat all the files with the same code in each?
>
> Yes, each vehicle has got its own attatched driver.

Why? A single command can be given any filename as an argument.

> Not like my real-life nightmare where I've got to fetch my single
> flashlite from location B or C to use at location A.

If you put all your executables in a directory in your PATH,
there's no problem.

> Interesting how OOD used inheritance to be more economical.
> My computing system 'postpones the common sharing for economy'
> to a very low-level: all jobs use the single/same CPU to eg. clear AX.
>
> I want to economise MY EFFORT, not file space.

You seem to be doing neither.

>> What happens when you need to modify the code? You have to edit it
>> in multiple places.
>
> This is an important consideration, which hopefully factoring and
> indirection would handle. So we're back to the 1950's concepts ?
>
>> If each file is written as a script, you could do it by sourcing
>> the code in each file:
>>
>> data=(
>> ....
>> ....
>> )
>> source /path/to/script
>
> I don't understand this,

The command, source, is a synonym for .; it executes a file in the
current shell environment, so that it can define variables and
functions to be used in the rest of the script.

> but it may be related to a recent optimisation:
> I'd evolved [by adding entries] a script m:
> echo ' g1277 <URL-list> <accumFetces>'
> echo ' <next command explanation I...>
> ...
> echo ' <next command explanation N...>
>
> So then I exercise the new-bash-trick that I'd just learned to:
> 'm > mOptinised'
> And edited mOptinised to bracket the contents in: 'cat << EOF'
> <the file>
> EOF
> But such cute optimisations don't increase my productivety much.
>
> I waste hours looking at bash code to try to simply:--
> Read(LineNumber)
> Write(LineNumber,ofFileX)
> ---
> And absurdly end up using awk inside bash !

There's nothing absurd about that. For many things, especially
dealing with large files, awk is the best tool to use.

> Even 'sed' seems a fraud, since the tutor-writters who just
> copy each other, tell what: 'sed 5q' and 'sed <all but line5>
> does. But NOT <print line 5 only>.

sed -n '5{p;q;}' "$file"


--
Chris F.A. Johnson, author | <http://cfajohnson.com>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
From: Bit Twister on
On Mon, 4 Jan 2010 10:56:48 +0000 (UTC), no.top.post(a)gmail.com wrote:
> In article <slrnhjupoh.71m.BitTwister(a)wb.home.test>, Bit Twister <BitTwister(a)mouse-potato.com> wrote:
>
>>
>> Yes. So does locate boj.data
>
> 'whereis + locate' is conceptually-DOUBLE 'whereis',
> "boj" + "boj.data" is conceptually-DOUBLE "boj".

Disregarding the switch about what I said,
I think I hear what you are saying, but not really the same thing.

> So you've got 4 times the cognitive load !!

No way.

locate makes one pass into the locate database. whereis makes several
calls looking in each directory in the $PATH variable until it can find the
executable or runs out of directories.