On Sat, Dec 12, 2009 at 02:05:43PM -0800, John Jason Jordan wrote:
> On Sat, 12 Dec 2009 13:26:30 -0800
> Keith Lofstrom <[email protected]> dijo:
> 
> >Perhaps I can help teach some scripting, and learn some GUI hacking
> >from others.  The real value of open source systems is that they
> >empower us to create, not just consume.
> 
> I would like to know about basic shell scripting. At the moment I know next to
> nothing. 
> 
> I would attend a class for beginners. Having said that, maybe it would be
> possible to do a web-based class. Moodle? Exercises for the student to do? A
> professor who will check for questions several times a day? Or does this
> already exist somewhere on the web? If not, could the creation of such a
> web-based instruction program become a PLUG project? 

Actually, John, you are one of the people I was thinking about when
I wrote that.  The best way to learn bash script basics is by doing
it.  Perhaps we can do "script improv" night at PLUG advanced topics
(this would actually be remedial advanced topics) where folks bring
in some small tasks they want to automate and we automate them.  

Two easy ways to get started with scripting, though.  

1) look for some small shell scripts on your system that do something
you understand, and learn to read them, using google to help you
figure out what each line or word does.  There are probably thousands
of 10 line or less bash scripts on your system to look at.

2) Make some of your command line interface calls into scripts.
That is, use vi to write a two line text file that does something
that you do regularly, and store it in your personal bin directory.

For example, the contents of /home/john/bin/fredspy might be:
-------------------------
#!/bin/bash
/bin/ls -tr /home/john/spyvideos/fred/
-------------------------
With /home/john/bin in your PATH, and with that script "chmod"ed
to 755, typing "fredspy" on the command line will list all the files
in the directory ~/spyvideos/fred/ (presumably videos from the
secret spycam you've hidden in fred's house).  

That is a boring example, but I do short scripts like that a lot,
to save typing and to help me remember how to do something.  Often,
my scripts are small mutations of scripts I previously wrote.

For extra bonus points, can anyone write a short script for John
that will help him do task 1?  Probably "find" feeding "grep"
(for /bin/bash) with some additional filters for short length
scripts or scripts with lots of comments.

Keith

-- 
Keith Lofstrom          [email protected]         Voice (503)-520-1993
KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon"
Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to