[ale] I have a single shell command complex syntax winner

Lightner, Jeff jlightner at water.com
Wed Jan 26 12:38:48 EST 2011


One of the reasons I document after writing scripts is that sometimes I
forget what I was doing initially and comments in the script help to
remind me.   They are of course also helpful to others who inherit or
share them.

By the way - you could have written a full script into your text file
then when you in your UNIX/Linux environment type "set -o vi".  You
could then hit esc-k to get your most recent command and hit "v" to get
a full vi buffer screen - replace the command that was in it with a
paste of your script from the text file then hit :wq!.   That would make
it run the full script but never actually save it as a script on the
system.  (This works for ksh, bash and Posix shell.)

Many of my scripts start with me doing some complex command line then
doing the esc-k and "v" to use that as a basis for the rest of a script.

-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
Michael B. Trausch
Sent: Wednesday, January 26, 2011 12:20 PM
To: Atlanta Linux Enthusiasts
Subject: Re: [ale] I have a single shell command complex syntax winner

On Wed, 2011-01-26 at 11:25 -0500, Greg Freemyer wrote:
> I thought I spoke command line pretty well, but on another list I just
> saw:
> 
> dcfldd bs=32k conv=noerror,sync sizeprobe=if if=/dev/sda
> of:='ewfacquirestream -c fast -d sha1 -D MAC20 -M physical -S 2000000
> -l "/media/HD-PVU2/MAC20/MAC20.log.txt.hashes" -t
> "/media/HD-PVU2/MAC20/MAC20" 2> /dev/null > /dev/null' errlog:='tee -a
> "/media/HD-PVU2/MAC20/MAC20.log.txt" > /dev/null' hashlog:='tee -a
> "/media/HD-PVU2/MAC20/MAC20.log.txt.hashes" > /dev/null'
> 
> That is one hard to parse statement, at least for me.  I think it
> launches 4 program instances without any of the normal connectors

At one point, I used to be very much in the habit of constructing
exceedingly complex command lines.  At a previous employer, we used many
different types of (authentic) UNIX and (other) UNIX-like systems, but
there was one rule that held true for all of them:  We (the support
people) were not allowed to put shell scripts on the systems---not even
in our home directories.  The reason that we were given was because
"that would alter the platform in a non-change-controlled way".
Personally that sounded like (hell, still does) a crock of crap.  But,
we weren't allowed.

So, to get around that, I would build one-liners.  The "parameters" to
the one-liners were shell variables.  I'd kept a text file on my laptop
that had the one-liners, a description of their inputs, and a
description of their outputs, if there was indeed any output.  The most
complex one started several (don't recall exactly how many) subshells
and had many pipes both in and between the subshells.  It was rather
nice to be able to paste in decaline-long commands and get something
done in a decisecond that previously took 20 minutes or more to do
manually.

I'd taken to building these one liners, and then after I'd tested them
sufficiently, I'd rewrite them as a well-formatted shell script that I
would put in the developers' ticket queue, in the hopes that they would
adopt the use of those shell scripts so that _everyone_ could benefit
from the scripts.  Sadly, that never happened.  Oh, well.

I am also pretty sure that if I still had a copy of those commands handy
that I would probably have to spend 45 minutes or more going through
them to figure out what they did.  Most of them were very specific to
AT&T SVR4 systems, and I quickly realized that I could not do my testing
on Linux, even after installing pdksh, because many of the core commands
had slightly different output formats, and the custom commands that were
on the systems did not exist, of course.

	--- Mike
 
Proud partner. Susan G. Komen for the Cure.
 
Please consider our environment before printing this e-mail or attachments.
----------------------------------
CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.
----------------------------------



More information about the Ale mailing list