Skip to content

Category Archives: Bash

process substitution in bash

05-Jun-05

.!. The internets are slow tonight, and I’m tired, so I’ll just leave you with something quick. Tommorrow I’ll pick back up on the podcast script. Let’s look at this short script: #!/bin/bash LIST=”" ls | while read FILE ; do    LIST=”${FILE} ${LIST}” done echo $LIST You may be suprised to find that LIST is [...]

coming soon

10-Apr-05

I’m working on a script randomly grab mp3s from a playlist and fill a CD with shuffled songs. I’ll be using bash’s built-in random number generator which I believe is available in all versions. Here’s the shuffle function for those interested: # Usage: shuffle <filename> function shuffle () { cat "${@}"|grep -v "^#" | \ [...]

tagging mp3s

22-Mar-05

Final installment of the podcast bash script for a while. I will eventually add the ability to auto-sync with my iPod, but I’m still undecided at which command line iPod tools I want to use. Currently gtkpod is doing a great job of keeping my iPod fed, and it’s simple to load it up, add [...]

fetching mp3s

17-Mar-05

So far so good. The next exercise is to actually make this script useful by fetching the MP3s and arranging them into easy to understand directories. The first order of business is to determine the name for the folder. I chose to use the channel name, and if that fails, the title of this episode. [...]

parsing some xml

07-Mar-05

Last night we looked at parsing urls out of the feeds. Tonight I’m going look at parsing a little more information. Specifically the channel title, item title, item enclosure, and item pubDate.

reading a list of feeds

06-Mar-05

Tonight I’m going to start off the script with reading a list of feeds, and fetching them for parsing. #!/bin/bash BASEDIR=”/mnt/usb0/mp3/podCast” FEEDS=”${BASEDIR}/feeds.lst” while read URL ; do while read LINE; do echo $LINE|sed -n ‘s/.*<link>\([^<]*\)<\/link<.*/\1/p’ done < <(wget -q -O – $URL) done < <(grep -v -e ‘^[;#]‘ -e ‘^$’ $FEEDS) podcast.001.sh We’re using grep [...]