Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #17020 > unrolled thread

Re: bash script problem ?

Started byno.top.post@gmail.com
First post2016-03-16 16:53 +0000
Last post2016-03-16 17:43 +0000
Articles 9 — 7 participants

Back to article view | Back to comp.os.linux.misc


Contents

  Re: bash script problem ? no.top.post@gmail.com - 2016-03-16 16:53 +0000
    Re: bash script problem ? William Unruh <unruh@invalid.ca> - 2016-03-16 17:08 +0000
      Re: bash script problem ? Unknown <dog@gmail.com> - 2016-03-17 11:00 +0000
        Re: bash script problem ? Joe Beanfish <joebeanfish@nospam.duh> - 2016-03-17 14:07 +0000
          Re: bash script problem ? Unknown <dog@gmail.com> - 2016-03-23 19:46 +0000
          Re: bash script problem ? Unknown <dog@gmail.com> - 2016-03-24 01:52 +0000
            Re: bash script problem ? Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> - 2016-03-23 21:31 -0700
              Re: bash script problem ? Bobbie Sellers <bliss-sf4ever@dslextreme.com> - 2016-03-23 21:53 -0700
    Re: bash script problem ? Rich <rich@example.invalid> - 2016-03-16 17:43 +0000

#17020 — Re: bash script problem ?

Fromno.top.post@gmail.com
Date2016-03-16 16:53 +0000
SubjectRe: bash script problem ?
Message-ID<ncc31c$gle$1@dont-email.me>
In article <>, Teemu Likonen <tlikonen@iki.fi> wrote: 

> 
> rich@example.invalid [2016-03-10 15:22:57Z] wrote:
> 
> > Step 1, don't use the legacy sh backtick substitution syntax for this
> > (because it cannot nest).  Use Bash's $() substitution instead (because
> > it can nest).
> 
> I agree that $() is better but ``'s can nest:=20
> 
>     $ echo Year: `date \`echo +%Y\``
>     Year: 2016
> 
That's spooky ! Who <associated> +%Y with "2016" ?
Lets have some examples of nesting, without extra spooky-stuf.

[toc] | [next] | [standalone]


#17022

FromWilliam Unruh <unruh@invalid.ca>
Date2016-03-16 17:08 +0000
Message-ID<ncc3v8$iug$1@dont-email.me>
In reply to#17020
On 2016-03-16, no.top.post@gmail.com <no.top.post@gmail.com> wrote:
> In article <>, Teemu Likonen <tlikonen@iki.fi> wrote: 
>
>> 
>> rich@example.invalid [2016-03-10 15:22:57Z] wrote:
>> 
>> > Step 1, don't use the legacy sh backtick substitution syntax for this
>> > (because it cannot nest).  Use Bash's $() substitution instead (because
>> > it can nest).
>> 
>> I agree that $() is better but ``'s can nest:=20
>> 
>>     $ echo Year: `date \`echo +%Y\``
>>     Year: 2016
>> 
> That's spooky ! Who <associated> +%Y with "2016" ?

The command "date" did. This says to run the date command with the
argument being the output of the echo command. In this case the latter
as +%Y so this is running
date +%Y 
which is the year in which the date command was run. The ouput is then
the argument to the outter echo command. 


> Lets have some examples of nesting, without extra spooky-stuf.

extra spooky-stuf? 
man date

>
>

[toc] | [prev] | [next] | [standalone]


#17037

FromUnknown <dog@gmail.com>
Date2016-03-17 11:00 +0000
Message-ID<pan.2016.03.17.21.04.33@gmail.com>
In reply to#17022
On Wed, 16 Mar 2016 17:08:56 +0000, William Unruh wrote:

> On 2016-03-16, no.top.post@gmail.com <no.top.post@gmail.com> wrote:
>> In article <>, Teemu Likonen <tlikonen@iki.fi> wrote:
>>
>>
>>> rich@example.invalid [2016-03-10 15:22:57Z] wrote:
>>> 
>>> > Step 1, don't use the legacy sh backtick substitution syntax for
>>> > this (because it cannot nest).  Use Bash's $() substitution instead
>>> > (because it can nest).
>>> 
>>> I agree that $() is better but ``'s can nest:=20
>>> 
>>>     $ echo Year: `date \`echo +%Y\``
>>>     Year: 2016
>>> 
>> That's spooky ! Who <associated> +%Y with "2016" ?
> 
> The command "date" did. This says to run the date command with the
> argument being the output of the echo command. In this case the latter
> as +%Y so this is running
> date +%Y
> which is the year in which the date command was run. The ouput is then
> the argument to the outter echo command.
> 
> 
>> Lets have some examples of nesting, without extra spooky-stuf.
> 
> extra spooky-stuf?
> man date
> 
> 
date `echo +%Y` == 2016
echo  `date \`echo +%M\`` == 33
echo  `date \`echo +%D\`` == 03/17/16
date `echo +%M` == 35
date `echo +%D` == 03/17/16

There's nesting: lisp; & there's concatenation/piping;
but this is a load of ad-hoc crap!


BTW `wily` is great for this.
No need to touch the kybrd.

[toc] | [prev] | [next] | [standalone]


#17041

FromJoe Beanfish <joebeanfish@nospam.duh>
Date2016-03-17 14:07 +0000
Message-ID<ncedmh$sqc$1@dont-email.me>
In reply to#17037
On Thu, 17 Mar 2016 11:00:14 +0000, Unknown wrote:

> On Wed, 16 Mar 2016 17:08:56 +0000, William Unruh wrote:
> 
>> On 2016-03-16, no.top.post@gmail.com <no.top.post@gmail.com> wrote:
>>> In article <>, Teemu Likonen <tlikonen@iki.fi> wrote:
>>>
>>>
>>>> rich@example.invalid [2016-03-10 15:22:57Z] wrote:
>>>> 
>>>> > Step 1, don't use the legacy sh backtick substitution syntax for
>>>> > this (because it cannot nest).  Use Bash's $() substitution instead
>>>> > (because it can nest).
>>>> 
>>>> I agree that $() is better but ``'s can nest:=20
>>>> 
>>>>     $ echo Year: `date \`echo +%Y\``
>>>>     Year: 2016
>>>> 
>>> That's spooky ! Who <associated> +%Y with "2016" ?
>> 
>> The command "date" did. This says to run the date command with the
>> argument being the output of the echo command. In this case the latter
>> as +%Y so this is running date +%Y which is the year in which the date
>> command was run. The ouput is then the argument to the outter echo
>> command.
>> 
>> 
>>> Lets have some examples of nesting, without extra spooky-stuf.
>> 
>> extra spooky-stuf?
>> man date
>> 
>> 
> date `echo +%Y` == 2016
> echo  `date \`echo +%M\`` == 33
> echo  `date \`echo +%D\`` == 03/17/16
> date `echo +%M` == 35
> date `echo +%D` == 03/17/16
> 
> There's nesting: lisp; & there's concatenation/piping;
> but this is a load of ad-hoc crap!
> 
> 
> BTW `wily` is great for this.
> No need to touch the kybrd.

<soapbox>
Not crap, beauty. The command line lets you form things the original
author didn't conceive of. Unlike most GUIs which only allow the small
set of things the author thought to allow you to do.

Sure the above examples are contrived and one would normally just
   date +%Y
But in a more complex situation as your original script the ad-hoc
ability of the command line is very useful and powerful.
</soapbox>

[toc] | [prev] | [next] | [standalone]


#17095

FromUnknown <dog@gmail.com>
Date2016-03-23 19:46 +0000
Message-ID<pan.2016.03.24.05.50.46@gmail.com>
In reply to#17041
On Thu, 17 Mar 2016 14:07:13 +0000, Joe Beanfish wrote:

> On Thu, 17 Mar 2016 11:00:14 +0000, Unknown wrote:
> 
>> On Wed, 16 Mar 2016 17:08:56 +0000, William Unruh wrote:
>> 
>>> On 2016-03-16, no.top.post@gmail.com <no.top.post@gmail.com> wrote:
>>>> In article <>, Teemu Likonen <tlikonen@iki.fi> wrote:
>>>>
>>>>
>>>>> rich@example.invalid [2016-03-10 15:22:57Z] wrote:
>>>>> 
>>>>> > Step 1, don't use the legacy sh backtick substitution syntax for
>>>>> > this (because it cannot nest).  Use Bash's $() substitution
>>>>> > instead (because it can nest).
>>>>> 
>>>>> I agree that $() is better but ``'s can nest:=20
>>>>> 
>>>>>     $ echo Year: `date \`echo +%Y\``
>>>>>     Year: 2016
>>>>> 
>>>> That's spooky ! Who <associated> +%Y with "2016" ?
>>> 
>>> The command "date" did. This says to run the date command with the
>>> argument being the output of the echo command. In this case the latter
>>> as +%Y so this is running date +%Y which is the year in which the date
>>> command was run. The ouput is then the argument to the outter echo
>>> command.
>>> 
>>> 
>>>> Lets have some examples of nesting, without extra spooky-stuf.
>>> 
>>> extra spooky-stuf?
>>> man date
>>> 
>>> 
>> date `echo +%Y` == 2016
>> echo  `date \`echo +%M\`` == 33
>> echo  `date \`echo +%D\`` == 03/17/16 date `echo +%M` == 35
>> date `echo +%D` == 03/17/16
>> 
>> There's nesting: lisp; & there's concatenation/piping; but this is a
>> load of ad-hoc crap!
>> 
>> 
>> BTW `wily` is great for this.
>> No need to touch the kybrd.
> 
> <soapbox>
> Not crap, beauty. The command line lets you form things the original
> author didn't conceive of. Unlike most GUIs which only allow the small
> set of things the author thought to allow you to do.
> 
> Sure the above examples are contrived and one would normally just
>    date +%Y
> But in a more complex situation as your original script the ad-hoc
> ability of the command line is very useful and powerful. </soapbox>

We're losing each other.
1. ad-hoc is when there are many ways of "saying it" instead of having
a minimalist/limited syntax: like lego or bricks&mortat or lisp.
When I looked at Ruby I remember you could <terminate statements with
";" or not>. That's bad. Redundancy is to be avoided.

2. GUI usually means 'cartoon based' - US-style.
 <mouse based> text means you execute a 50-char command with one-action,
 without;
1. need to rememeber it - you recognise and select it from a menu;
2. no need to look away from the screen and lose 'focus'.

Here's an example of what wily does for me [ETHOberon is better because
it's got colors, which helps decode my cryptic short-hand]:

Mwt <-- writes the TextToSpeech-Menu for Wily; which looks like:-
1=Select DestName & M2M1: |Arg1 to /mnt/h15/var/CONTROL/WtmpL
2=Append Text Selection & M2 |Apnd1 : to tail -2 /var/CONTROL/WApnd 
3=M2 DLt2wavMul : <1>.mp3 to /mnt/h14/home/crg/mul/    ^  M2M1  rm

As stated, this mess is better understood with colors.
The task is to copy text to <speech>.mp3 to a mobile phone.
There are 2 args:
1. the text-stretch, identified by its begin and end;
2. the chosen name of the *.mp3

But I wanted to make it more versatile by being able to append pieces
of text to a buffer,to a get a minimum of 5 minutes speech.
If I see a suitable name anywhere on the screen, it's 2 cliks to select
that name: 1 to <select> it plus a klux[mouse chord] on "|Arg1" in line 1.

I must first delete the buffer contents of the previous job.
 This needs 2 cliks:
1. select "/mnt/h15/var/CONTROL/WtmpL" which is the buffer @ line 2;
2. <chord> on "rm" in line 3

To mark the text-stretch to be appended to the buffer, need2 2 cliks
on the start and end. 2+2=4

Finally 1 clik on line 3's DLt2wavMul, converts the buufer's text to
 <chosenName>.mp3 ready to be used.

mouse chording listed as "M2M1" to remind me, means press buttom-2
and button-1, is handled better with ETHOberons colors [from where
wily, the PublicDomain version of plan9's acme is COPIED]

ETHOberon would write the 2 clik commands in green and the 2 chords
in red, which is more intuitive than needing to read & decode "M2M1".

NB. the designers of unix, went on to make plan9, to do it properly;
-- from what I've read.
Don't confuse menu-driven, point-and-chord with cartoon-based systems.

OTOH for users doing what they are familiar with, and it's all in their
head, reflex-like piano-playing is OK, since they don't need to see the
screen. Your dog catches a ball by reflex too.
 
PS. you notice I've got:
  tail -2 /var/CONTROL/WApnd 
which I can just wipe & clik, to see if the buffer is clean, or what
was the last text appended.

That's 26 + 1 = 27 keystrokes for piano-players.

[toc] | [prev] | [next] | [standalone]


#17096

FromUnknown <dog@gmail.com>
Date2016-03-24 01:52 +0000
Message-ID<pan.2016.03.24.11.57.33@gmail.com>
In reply to#17041
On Thu, 17 Mar 2016 14:07:13 +0000, Joe Beanfish wrote:

> ......... The command line lets you form things the original
> author didn't conceive of. Unlike most GUIs which only allow the small
> set of things the author thought to allow you to do.
> 
Indeed my worst case is this damned web-baseed-gmail.
It's like getting cofee, with one arm tied behind your back.
When you ask for sugar, you must put the coffee cup down on the floor,
and then ask for a tea-spoon, and go on-line again to re-ask for sugar,
and then dip a spoon-full of sugar .........

With ETHO, I could have multiple Rx-ed & drafts, written mails, all on
the screen together, with the <server directory> all at the same time,
mouse: select + click :: send that-one, fetch that-one ......

> But in a more complex situation as your original script the ad-hoc
> ability of the command line is very useful and powerful.  

Exactly; but you conflate GUI v keybrd-based-command-line
  with cartoon-based-single-window v See&select-multiple-text-frame/window

But I must admit that cmnd-line allows piping/serial-transformations.
ETHO & wily deliver each stage to a new/extra textFrame/window, where
See&select is manually done to get to the next stage.

Piping/serialy-transforming is off course unbeatable for programmed
operations, like:
  show the lines containing <text1>
  in all files of <dir-tree>
  and only <N days old>
  but not *.pdf, *.gif files
  and the file also contains <text2> & <text3>

..........

[toc] | [prev] | [next] | [standalone]


#17097

FromKeith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Date2016-03-23 21:31 -0700
Message-ID<367cscxhq9.ln2@goaway.wombat.san-francisco.ca.us>
In reply to#17096
On 2016-03-24, Unknown <dog@gmail.com> wrote:
> 
> Indeed my worst case is this damned web-baseed-gmail.

https://support.google.com/mail/troubleshooter/1668960?hl=en

> It's like getting cofee, with one arm tied behind your back.

It's like getting coffee, with one arm tied behind your back, and being
too stupid to ask the person sitting right next to you to untie you.

--keith


-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

[toc] | [prev] | [next] | [standalone]


#17098

FromBobbie Sellers <bliss-sf4ever@dslextreme.com>
Date2016-03-23 21:53 -0700
Message-ID<ncvrmd$qq0$1@dont-email.me>
In reply to#17097
On 03/23/2016 09:31 PM, Keith Keller wrote:
> On 2016-03-24, Unknown <dog@gmail.com> wrote:
>>
>> Indeed my worst case is this damned web-baseed-gmail.
>
> https://support.google.com/mail/troubleshooter/1668960?hl=en
>
>> It's like getting cofee, with one arm tied behind your back.
>
> It's like getting coffee, with one arm tied behind your back, and being
> too stupid to ask the person sitting right next to you to untie you.
>
> --keith
>
>
	Well you are responding to the unknown troll long ago plonked in
my alternative universe.
	
	Web Mail is pretty awful and one of the reasons I use my tablet
only in emergencies or for taking pictures.  Thunderbird might tame
it offline or even make it easier online.  Lots of other tools for
the same purpose i.e. reading and writing and administrative tasks
with the mail.

	bliss - Please don't feed the trolls...
		Feeding them helps them thrive.

[toc] | [prev] | [next] | [standalone]


#17025

FromRich <rich@example.invalid>
Date2016-03-16 17:43 +0000
Message-ID<ncc603$o0q$3@dont-email.me>
In reply to#17020
In alt.os.linux.slackware no.top.post@gmail.com wrote:
> In article <>, Teemu Likonen <tlikonen@iki.fi> wrote: 

> > 
> > rich@example.invalid [2016-03-10 15:22:57Z] wrote:
> > 
> > > Step 1, don't use the legacy sh backtick substitution syntax for
> > > this (because it cannot nest).  Use Bash's $() substitution
> > > instead (because it can nest).
> > 
> > I agree that $() is better but ``'s can nest:=20
> > 
> >     $ echo Year: `date \`echo +%Y\``
> >     Year: 2016
> > 
> That's spooky ! Who <associated> +%Y with "2016" ? Lets have some
> examples of nesting, without extra spooky-stuf.

Execute "man date" in a xterm - read the results - you will learn
something.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.os.linux.misc


csiph-web