Shell scripts


These scripts come without warranty of any kind. Use them at your own risk. I assume no liability for the accuracy, correctness, completeness, or usefulness of any information provided by this site nor for any sort of damages using these scripts may cause.


This is a loose collection of my shell scripts for UNIX-like operating systems. Most were only tested on Linux, but I tried to make them portable by avoiding bash-isms and GNU extensions. The degree of usefulness varies — some scripts were made for fun only while others have many practical applications. Each script's license as well as detailed usage information can be found in that script's comments.

Encoding text into a binary string

This script converts text read from standard input into a series of binary digits representing the ASCII codes of characters read (also works with other character sets, including UTF-8, if the locale is configured properly) and prints the result to standard output. For example, hello becomes 0110100001100101011011000110110001101111.
License: public domain
Download: encode-binary

Decoding a binary string into ASCII text

This script can decode text encoded by encode-binary by converting a string of ones and zeroes (whitespace is ignored) back to ASCII text (works with other charsets, just as encode-binary does).
License: public domain
Download: decode-binary

Generating wordlists from aspell dictionaries

This is a script for generating wordlists which can be used by tools such as John the Ripper from aspell dictionaries. The default list of languages contains English and Polish, other languages can easily be added by putting their abbreviated names in array languages. All accented characters are converted to their non-accented counterparts since that is the way most people enter their passwords.
License: public domain
Download: generate-wordlist

Viewing file download progress

A script which displays the percentage of a file that has been downloaded in a GTK+ dialog box (uses zenity). Useful when downloading files with command line tools (e.g. wget) in the background.
License: public domain
Download: view-download-progress

Temporarily disabling X ScreenSaver

This script can be used to run an arbitrary command, disabling xscreensaver until the command finishes (useful for games).
License: public domain
Download: run-without-xscreensaver

Replacing fragments of one file with corresponding fragments of another file

Using this AWK script, a template can be used to create a file and then update some parts of the file with corresponding parts of the template whenever the template is changed. This can be useful e.g. for editing HTML files when SSI is not available, yet the menu or other parts of each page need to be kept in sync with the page template.
License: public domain
Download: replace-file-fragments

From the homepage of Michał Kosmulski,
Unless indicated otherwise, all content © 2004-2016 Michał Kosmulski. All rights reserved.