A collection of all kinds of shell scripts

Organisation:Copyright (C) 2008-2024 Olivier Boudeville
Contact:about (dash) hull (at) esperide (dot) com
Creation date:Sunday, August 17, 2008
Lastly updated:Wednesday, September 4, 2024
Version:1.0.10
Status:Stable
Dedication:Users and maintainers of Ceylan-Hull.
Abstract:The role of Hull is to concentrate various, generic-purpose convenience shell scripts, on behalf of the Ceylan project.

The latest version of this documentation is to be found at the official Ceylan-Hull website (http://hull.esperide.org).

This Hull documentation is also available in the PDF format (see Ceylan-Hull-technical-manual-english.pdf), and mirrored here.

Overview

Here are a few scripts, sorted by themes, that may be convenient for at least some users.

Many of them can display their intended usage on the console by specifying them the -h / --help command-line option.

In each category, scripts are roughly sorted by decreasing interest/update status. The scripts that we deem the most useful are described more precisely at the end of this document.

As much as possible, we try to name these scripts functionally rather than in terms of tools, so that the implementation they rely upon can be updated as transparently as possible (i.e. with as little change as possible in the user's habits).

These scripts are intended for all kinds of Unices, especially GNU/Linux, yet most of them are believed to work on Windows as well, provided a relevant context exists there.

Each script entry is a link pointing directly to the script itself. They may be directly obtained as a whole from the Hull repository.

Most of them are certainly not rocket science.

Note

A few of these scripts may be a bit outdated, as not all of them are daily used; rely on them with (a bit of) caution! (and tell us if you would like some of them to be updated).

Detailed description of some frequently-used scripts

wh

wh (for "where"): searches (as a more user-friendly 'find') all files and directories matching <filePattern>, from <starting_directory> if specified, otherwise from current directory.

Usage: wh [-h|--help] [--verbose] [-q|--quiet] [--no-path] [--exclude-path <a directory>] <filePattern> [<startingDirectory>]
Options:
[-q|--quiet]: only returns file entries (no extra display); suitable for scripts (e.g. for f in $(wh -q 'foo*'); do...)
--no-path: returns the filenames without any leading path
--exclude-path DIR: excludes specified directory DIR from search
regrep

regrep: recursive grep for the ones that lack it.

Usage: regrep [-v|--verbose] [-q|--quiet] [-f|--filenames-only] [-i|--insensitive] [-r|--restructured] [-e|--exclude ELEM]* <Expression to be found in files> [<Filter on files>]
Options:
-v or --verbose: be specifically verbose
-q or --quiet: be specifically quiet, just listing matches
-f or --filenames-only: display only filenames, not also the matched patterns, and if there are multiple matches in the same file, displays its filename only once (implies quiet); typically useful in scripts
-i or --insensitive: perform case-insensitive searches in the content of files, and also when filtering any filenames
-r or --restructured: use ReStructured text mode (skip tmp-rst directories, search only *.rst and *.rst.template files)
-e or --exclude ELEM: excludes the specified filesystem element (e.g. file or directory) from the search; as many -e/--exclude options as wanted can be specified

Example: regrep --exclude ./foo.dat --exclude ./backup-dir -i 'little red rooster' '*.txt'.

See also: ergrep (for searching specifically in Erlang files), pygrep (Python version), jgrep (Java version), jsgrep (Javascript version), jsxgrep (React JSX version) and cgrep (C version).

srm

srm (for "secure rm"): stores deleted files/directories in a trash instead of deleting them directly, in order to give one more chance of retrieving them if necessary. Ensures that no two file elements can collide in trash so that all contents are preserved.

Usage: srm <files/directories to delete securely>
See also: empty-trash.sh

Shell Configuration

One may also have a look at our related Ceylan-Heavy's generic, flexible shell configuration (namely .bashrc* files).

See also

Support

Bugs, questions, remarks, patches, requests for enhancements, etc. are to be reported to the project interface (typically issues) or directly at the email address mentioned at the beginning of this document.

Please React!

If you have information more detailed or more recent than those presented in this document, if you noticed errors, neglects or points insufficiently discussed, drop us a line! (for that, follow the Support guidelines).

Ending Word

In the hope that Ceylan-Hull will be of use for you as well!