[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pmount could perhaps be of greater utility?



On 07.05.19 10:12, David wrote:
> On Mon, 6 May 2019 at 23:53, Erik Christiansen <dvalin@internode.on.net> wrote:
> > On 06.05.19 09:03, Greg Wooledge wrote:
> > > On Sat, May 04, 2019 at 01:48:01PM +0200, Jonas Smedegaard wrote:
> > > > Quoting Erik Christiansen (2019-05-04 08:43:53)
> 
> > > > >      pmount $1 `e2label $1`
> 
> > > and is using the ancient deprecated command substitution syntax (which
> > > will work in this case, but is not a good habit).
> 
> > That does appear to remain opinion. The venerably traditional syntax is
> > still fully legal supported bash syntax, e.g.:
> >
> > http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_03
> >
> > The recent (late last century, IIRC) introduction of the $(...)
> > alternative syntax has admittedly brought newer *nix users who know
> > nothing else, and so delude themselves that there is nothing else. That
> > is a misapprehension. To each, his own, especially amongst adequately
> > equivalent alternatives.
> 
> Hi Erik
> 
> Maybe you would enjoy answering this question then?
> https://lists.gnu.org/archive/html/help-bash/2019-05/msg00000.html
> 
> Because apparently no-one else has, hehe :D

I can see why - the question wilfully exploits the fact that bash is not
a full programming language, and only the author is dumb enough to construct
such self defeating perversity as using two echos to fabricate difficulty
where none need exist. (Please read next paragraph before kneejerking.)

In a real case of substitution of more substantial commands, it is both
simple and convenient to perform the operations sequentially (i.e. on
separate lines), rather than obfuscate with unnecessary nesting.

Having an intermediate result in a shell variable can often save a lot
of debugging time, both during script development and later, when
unanticipated input causes undesired effects. Having to deconstruct a long
nested assemblage in order to debug it leads to a chained implementation
in any event.

Erik

-- 
Good judgement comes from experience.
Experience comes from bad judgement.                      - Jim Horning


Reply to: