Free Shell and Python Scripts


Licence terms
How to download
mail notifier
cd from menu
safe mv command
get programme IDs from BBC schedules
check that a BBC programme is not a repeat
display a schedule for BBC Radio 4
file transfer with SSH
rename photos to date and time

back to contents


All the programs on this page contain the following licence:

Copyright (C) 2021 Peter Scott - This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <>.

By downloading a script you are accepting the terms of the GNU General Public License for the script.

back to contents


The scripts often contain tabs or other odd characters so they cannot be pasted. You have to do a "save link target as" to a directory on your PATH and make the script executable. If you are using an iPad, or merely want to look at a script you can use the "(see it)" link by the download link.

Alternatively, you can get them or see them on my github page.

back to contents -- mail notifier watches an IMAP account and alerts you with a beep and a very small pop-up when new mail arrives. It takes up no permanent screen space. Here is a snapshot of a corner of my workspace showing the pop-up: message
I start in my .bash_profile and stop it from my .bash_logout.

back to contents

cdm -- cd from menu (see it) displays a menu like this:
menu in xterm
and lets you choose the directory you want by name or by number. (In the screenshot, the reply has been copied -- not typed!) Directories can be omitted from the menu, or added, by setting up a couple of hidden files.

back to contents

sfmv -- safe mv command

sfmv is better than the standard mv command's --no-clobber option because it gives an error message when it doesn't move a requested file.

back to contents

getPids -- get PIDs from BBC schedules

getPids extracts programmme IDs from the BBC schedules using a Python parser to unravel the HTML. getPids has been tested with Python 2.7 and Python 3.7 on Linux, and with Python 3.6 on Windoze 7.

getPids -6 bbcone hd -- would put a week's BBC 1 (HD) TV schedule onto standard output. The week here comprises today and the six previous days. You can see past and future days.

back to contents

chkNew -- check that a BBC programme is not a repeat checks that a BBC programme is not a repeat.

chkNew m0000sdx 2018/10/21-20:00 checks whether the programme (pid m0000sdx) was shown before its scheduled date (2018/10/21-20:00).

chkNew m0000sdx checks whether the programme was shown before today.

chkNew runs on Windoze as well as *nix.

back to contents

sched -- display a schedule for BBC Radio 4

sched uses getPids and chkNew to display a schedule for the week's BBC Radio 4 programmes with repeats omitted or flagged.

The current week's output from sched is available here. This is to avoid wasting time on the Beeb's servers.

back to contents

SFTP -- transfer and compare files on remote systems with SSH

SFTP is a convenient front-end to the sftp command; it can be used from the command line to move files about or compare them, or it can be called from cron or from any shell script. SFTP uses the batch mode of sftp but you don't have the hassle of setting up a batch file or reading all the output. Clearly, it is only useful if you have set up password-less logins.

SFTP works with SSH, Open-SSH and Sun's dumbed-down version of Open-SSH.

rsync could, of course, be used instead to do the gets and puts.

back to contents

jpgMv -- rename photos to date and time

jpgMv uses jpgDate to rename a collection of jpg files so they have names like 2005-10-13_00.jpg or 2005-10-13+15-15-46_00.jpg. jpgMv is particularly useful when merging many photos into one directory; it does not overwrite existing files. jpgDate uses exiftool to get the date and time from the JPEGs.

This job can be done nowadays by using exiftool directly. However, jpgMv predates exiftool; jpgDate used to use another method of getting the dates.

back to contents

Valid html5 Peter's Home Page Valid CSS