Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re (2): HOW2 make an objectified bash script ?

0 views
Skip to first unread message
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

no.to...@gmail.com

unread,
Jan 2, 2010, 5:06:24 AM1/2/10
to
In article <slrnhjsluq.9...@wb.home.test>, Bit Twister <BitTw...@mouse-potato.com> wrote:

> ["Followup-To:" header set to comp.os.linux.misc.]
> On Fri, 1 Jan 2010 17:08:30 +0000 (UTC), no.to...@gmail.com wrote:
> > I want to be able to:
> > * call the script: boj
> > * which then shows it's can-do-menu
> > * initially say -
> > 1= append to my [probably 1 per line] known phrases;
> > perhaps the lines are just appended below the code's 'exit'.
> > 2= show my list of known phrases,
> > 2a= and accept an index or a 'key' to return the selected 1-line-known-phrase.
> >
> > The hope is that my existing utilities which can call shell, would be able to
> > go off and store eg. path/FileIDs and fetch a phrase, eg. for execution.
> >
> > 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.
>
> That file could be an array of phrases.
Bash already handles one-phrase-per-line.
It's pointless to introduce the low-level concept of arrays.
>
> Your other apps call boj which loads/displays boj.array.
If boj's data is IN boj then it won't get lost and I can find it by:
'whereis boj'
>
> User picks a selection and boj can pass the phrase id or phrase
> back however you like.
Well that's what I need the code for.
I've done the top-desig, which you wrongly change,. instead of
giving me the implementation of MY design.
>
>
> Design is up to you. boj could be a program/app or just a bunch of
> functions to manage boj.data.
>

> 1. Your existing utilities call boj with command/arguments or
> 2. you script boj commands in your utilities by sourcing functions
> found int boj.
>
> Example 1: _result=$(boj get_phrase)
> boj add_phrase "whatever"
>
> Example 2: . boj # source boj functions/code
> _result=get_phrase()
> add_phrase "whatever"
>
Is this bash code ?


Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages