Initial commit: HPR Knowledge Base MCP Server
- MCP server with stdio transport for local use - Search episodes, transcripts, hosts, and series - 4,511 episodes with metadata and transcripts - Data loader with in-memory JSON storage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
122
hpr_transcripts/hpr0045.txt
Normal file
122
hpr_transcripts/hpr0045.txt
Normal file
@@ -0,0 +1,122 @@
|
||||
Episode: 45
|
||||
Title: HPR0045: Shell Scripting
|
||||
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0045/hpr0045.mp3
|
||||
Transcribed: 2025-10-07 10:41:18
|
||||
|
||||
---
|
||||
|
||||
Song by
|
||||
Hello and welcome to episode 45 of Hacker Public Radio.
|
||||
Today I'm your host, Doss Man, and today we're going to talk about shell scripting.
|
||||
So what exactly is shell scripting versus other programming languages?
|
||||
Basically, shell scripting is just a quick and easy way of stringing together several
|
||||
different commands that already do the work you need to do, but you just need to automate
|
||||
that.
|
||||
And there's a lot of different ways to use shell scripts and whatnot.
|
||||
There's a lot of different shells.
|
||||
Now what other kind of examples might there be or what would make us different from
|
||||
other programming?
|
||||
Something like say, Perl would be probably a little bit better solution for a lot of things,
|
||||
but for whatever reason, if you already know shell scripting, there's nothing wrong with
|
||||
using that as opposed to Perl.
|
||||
Perl is a little bit more programming, shell scripting or shells, corn shell, born-again
|
||||
shell, bash shell, sea shell, all those.
|
||||
There were their own unique syntax, basic looping capability, variables, and whatnot.
|
||||
So they provide some basic programming functionality for the typical Unix Administrator or anyone
|
||||
else, per se.
|
||||
So I guess we'll jump into what really is the written butter of shell scripting.
|
||||
But a lot of that is basically mostly using other commands.
|
||||
You're just manipulating other commands to do your bidding in an automated fashion.
|
||||
Other commands, mostly like the Unix Utilities, like Cat, Soar, Grip, Head and Tail.
|
||||
You're basically saying you need to analyze some log files automatically and send yourself
|
||||
a notification.
|
||||
Well, you know, you just use Grip to extract out, you know, look for certain strings,
|
||||
like saying you're a sys log.
|
||||
And then if there is a match found, you can use, you know, like mail X or mail or some
|
||||
dogmaically send yourself an email to your cellphone or whatever when there's a problem found.
|
||||
So of course, really what you're learning is the syntax of all these external commands
|
||||
that you're using for the shell script and then just, you know, learning how to string
|
||||
them together through the use of the shell.
|
||||
There's also a bit more complicated shell or not shell, but Unix Command, like said
|
||||
in Ock.
|
||||
I wouldn't exactly call this complicated, but there's a lot of functionality in those
|
||||
two commands right there that you can do.
|
||||
And it's kind of funny to see over and over new programming languages, we implement with
|
||||
these two commands had, you know, years ago.
|
||||
So you know, there's a lot that you can do.
|
||||
You can pretty much do anything that you would normally do in Perl and a shell script.
|
||||
But the, it may not be quite as efficient because the way you have to interact with the
|
||||
commands, you know, but said in Ock, give you a lot of ability there, like, uh, Ock typically
|
||||
I'll use that for extracting columns, like say you have some output and you need to separate
|
||||
based on, you know, a common delimiter, you can use an Ock with a dash f flag and then
|
||||
a comma and it'll separate.
|
||||
And then, uh, then I, you know, do a print and a dollar sign, uh, three to get the third
|
||||
column separated by semicolon or colon, comma, I said.
|
||||
And, uh, so, you know, you can cut up your data in certain ways.
|
||||
Ock, you could actually do in your entire script probably and said just said or just Ock.
|
||||
They're a very full featured, uh, programs, but I only use a very tiny subset of their
|
||||
features typically said is really good for, uh, of course, said is the stream editor basically
|
||||
it's just a line at a time editor and you perform functions based on a line, uh, a, you
|
||||
know, based on a single, you know, field per se.
|
||||
And so you could, uh, a lot of times I'll do like a, uh, substitution and that's real
|
||||
handy way of basically match the string and then change it to this other string or also
|
||||
another way you could use that, uh, I use that a lot to just blank out a certain portion
|
||||
of the string that I don't want.
|
||||
Um, so if this, if this, you know, find the string and just remove it from my, my input
|
||||
line, uh, Ock, again, looks at the whole document and sort of works on columns, although
|
||||
that it's not the only thing it does.
|
||||
But, uh, now there, there's a lot there, um, now also a lot of what people probably use
|
||||
and what I use are third party tools, uh, that are not, I wouldn't say classic Unix tools
|
||||
but these days pretty much are like, say, W get, um, I'll use that a lot to retrieve things
|
||||
for myself and, uh, do that in an automated fashion like all, uh, one script that I use
|
||||
that's, uh, fairly, got to be fairly large for a radio station and I, it automatically
|
||||
checks the latest gas prices from gasbuddy.com and, uh, what it does, it loads the front page
|
||||
with W get, I pull it down and then I use said and Ock and other various utilities to carve
|
||||
out the, uh, names, the URLs for the image files that I have currently contained in the
|
||||
current gas prices and then I'll, uh, parse through and use W get again to download those
|
||||
image files, um, individually from the site and then I'll pipe them through, uh, image
|
||||
magic and then, uh, go CR, uh, uh, good new, uh, OCR program and extract the, uh, text
|
||||
data per se that that image contains, um, and then, uh, at last lay, I feed that into
|
||||
festival, um, and without, before going into festival, I actually will feed it through
|
||||
ECA Sam, which is a command line, sound board, uh, sound program that you can, uh, change
|
||||
the bit rate, change, uh, you know, quality or whatnot or me. And the reason I do that
|
||||
is I make it match, uh, the same characteristics as a piece of background music and then merge
|
||||
them together and of course you have to cut the background music off at a certain length
|
||||
so you don't have, you know, like your, your 45 second gas report and then another minute
|
||||
of music running in the background. So, so you can do quite a bit, uh, with shell scripts,
|
||||
whatnot and, you know, someone, it might be better to, to do this in parole, it might be
|
||||
more efficient possibly but, uh, it, at the moment I've gotten to be, uh, probably too good.
|
||||
I don't want to say that I'm too good at shell scripting but I've gotten good enough,
|
||||
I can do everything I want to do with it. I'm really not a programmer but I do enjoy being
|
||||
able to automate things and whatnot. So, uh, there's, uh, you know, I've gotten good enough that
|
||||
I can do anything that I want to do with, with, with, uh, shell scripting, uh, compared to any other
|
||||
type of, uh, typical scripting language like parole or, uh, Python or something, you know. So,
|
||||
until I find he had an even bigger project that I want to do, uh, uh, you know, I, not to say
|
||||
I don't know anything about parole but, uh, I, I, I have to, I enjoy just being able to sit down
|
||||
and get results right away and basically I'm impatient and since I, uh, I know enough parole to,
|
||||
uh, fix other people's scripts and stuff, uh, make them do my bidding, uh, but I, uh, if I'm writing
|
||||
something from scratch, I usually start with shell script. Um, so anyway, um, yeah, I mean,
|
||||
and the other thing is, you know, I really don't like re-inventing the wheel. Uh, if there's a,
|
||||
a binary program that does what I want to do and I just need to automate it, fine. Um, I, I just
|
||||
use a shell script to, uh, you know, someone else has already done the hard work of writing the
|
||||
program that does something like, you know, like the Aircrack suite and then all I want to do is just
|
||||
automate it, you know, so, um, all right, uh, I guess an actual kind of move into some places
|
||||
shell scripts are commonly used, um, and that you might encounter them, uh, you know, like,
|
||||
configure scripts. If you, uh, build a compile open source software, uh, that's all, uh, you know,
|
||||
shell scripting and, uh, you know, custom tools. If, if, you know, if you're a unique sad man,
|
||||
you're always doing something. It may not be, a lot of people probably are a bit more advanced
|
||||
in using parole or something, but, you know, shell script, uh, quick and dirty is a,
|
||||
easy way to solve a lot of problems, you know, um, there's also, uh, probably places that a
|
||||
shell script shouldn't shouldn't even be used. Uh, one place, be like Apache CGI's, um, you know,
|
||||
that's, uh, pretty dangerous to use a shell script in a CGI, uh, because if something breaks in
|
||||
your script, you're actually left with a real shell there, and that's one reason probably why
|
||||
parole is traditionally used in that environment, although PHP is taken over that role now, but,
|
||||
um, you know, a parole script, uh, if it breaks and it dumps out, it's just a parole interpreter.
|
||||
There's no shell there. So you can do CGI's in shell, and I'll, I'll
|
||||
will admit that I've done that from time to time, uh, the quick and dirty way to get something done,
|
||||
but I would not leave that in a production environment or something. That's not a good,
|
||||
good place for, for a shell script for that reason. So, um, yeah, uh, I guess that's, uh,
|
||||
about all I had to talk about today. Um, hope, uh, this was informative for, for someone that's
|
||||
not familiar, per se, with shell scripting, uh, hope you have a good day. Enjoy it. And talk to you later.
|
||||
Thank you for listening to Hack with Public Radio.
|
||||
HPR is sponsored by Carol.net, so head on over to C-A-R-O dot-N-E-T for all of us in the
|
||||
Reference in New Issue
Block a user