[PLUG] Saving terminal commands

Keith Lofstrom keithl at kl-ic.com
Wed Feb 4 18:47:14 UTC 2009


On Wed, Feb 04, 2009 at 09:10:36AM -0800, John Jason Jordan wrote:
> I'm more a GUI kinda guy, but there are certain commands that I use
> repeatedly in the terminal. For example, I use cdparanoia and lame to
> rip and encode CDs from my collection. But sometimes I don't use those

Oh, you are in for a treat!  This is exactly what Linux is for,
all the rest is window dressing.

Shell scripts.

Put the commands, plus explanation in comments, in shell scripts.
You don't even have to remember what the shell scripts are named;
it is easy to build desktop launchers from the gnome menu, and
you can provide your own graphic icon as a .png or whatever.

The script is just the list of commands, with a "#!/bin/bash" for
the first line.  No special naming needed (.bat? ugh!), just do a 
"chmod 755 scriptname" and it will be executable.  You can add the
script to /usr/local/bin, or you can make your own bin directory.

I have made hundreds of shell scripts.  With a leaky memory like
mine, it is the only way to keep track of past successes.  Shell
scripts can call other shell scripts.  They can have command line
parameters.  If you look around your system, you will be astonished
at how many functions, command line and gui, are implemented as
shell scripts.  While many of the scripts will be too arcane for
a newbie to understand, some are dead simple, and you can copy
them to new names, then mutate them for new functions.  

You have an advantage - you are a linguist.  The hardest part
of scripting for me is keeping track of which three year old
script does what.  While I can grep for comments, it is easier
to just *name the damned things correctly*.  Linguists should
be excellent at designing naming conventions.

Shell is a complete programming language.  You can do a lot of
amazing stuff with it.  Before too long, you may find yourself
moving on to Perl or Python, allowing you to do far more amazing
stuff.  Remember, copy and modify are allowed and even encouraged
in Linux, and it is how fellows like myself, with very limited
programming ability, are able to accomplish things that required
PhDs two decades ago.

I visualize John firing up his brand new 5 horsepower concrete
drill.  No more tap-tap chisel-chisel.  Oooh, this is exciting!

Keith

-- 
Keith Lofstrom          keithl at keithl.com         Voice (503)-520-1993
KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon"
Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs



More information about the PLUG mailing list