Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jessekelighine/whenever
whenever: run a command whenever a file/directory is changed
https://github.com/jessekelighine/whenever
Last synced: 11 days ago
JSON representation
whenever: run a command whenever a file/directory is changed
- Host: GitHub
- URL: https://github.com/jessekelighine/whenever
- Owner: jessekelighine
- License: gpl-3.0
- Created: 2023-09-29T08:21:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-28T05:58:02.000Z (11 months ago)
- Last Synced: 2024-04-22T15:26:09.218Z (9 months ago)
- Language: Shell
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# whenever: run a command whenever a file/directory is changed
`whenever` is a simple terminal utility that lets you run a command whenever a file or directory is changed.
`whenever` is implemented in about 50 lines of bash script.## Installation
Everything is self-contained in the bash script `whenever.sh`.
Download the script `whenever.sh` and make a link using
```sh
ln -si path/to/whenever.sh /usr/local/bin/whenever
```
where `path/to/whenever.sh` is the path to the downloaded script.## Usage
```
usage: whenever [file|dir] [command]
description: run [command] whenever [file|dir] is modified.
```For example, the following command will echo `Hello` whenever `file.txt` is modified:
```sh
whenever file.txt echo "Hello"
```
`whenever` will display a message and keep count on the times `[file]` is modified and `[command]` is run.Another more useful example is to compile a $\mathrm{\LaTeX}$ file whenever a file in the same directory,
usually different sections of the $\mathrm{\LaTeX}$ document,
is changed.
Say you have a directory `paper/` that looks like this:
```
paper
├── main.tex
├── section-appdix.tex
├── section-discussion.tex
├── section-into.tex
└── settings.sty
```
In this case, when you are in directory `paper/`, you can use
```sh
whenever . pdflatex main.tex
```
so that you don't have to manually compile whenever you change one of the "section" files.## Settings
Here are some variables that can be customized:
- `WHENEVER_COMMAND`: The command used to check whether files are modified. (default: `md5sum`)
- `WHENEVER_INTERVAL`: Time interval (in second) between checks. (default: `1`, i.e., check for changes once every second)## License
License: GPL-3
Copyright 2024 Jesse C. Chen