DEV Community

loading...

Automation using ENTR

devhypercoder profile image DevHyperCoder ・1 min read

PS this is my fist post on dev.to :)

entr is a command line utility to run commands when file(s) change. Meaning, entr can be used for anything, ranging from a LaTex recompilation to updating your status bar!

Installation

entr should be available in most *nix distributions' package repos. Use the package manager to install it. Check out the github repo for more info on compiling it manually.

Usage

Lets assume you have a LaTex file named notes.tex. Now, to recompile the LaTex document, we need to run pdflatex notes.tex notes.pdf. Lets automate this. The general way to run entr is

ls <name of file> | entr <command to execute>

so, changing it to our needs,
ls notes.tex | entr pdflatex notes.tex notes.pdf

Useful options!!

Here are a few useful options for entr,

  • -p -> Don't run the command at startup
  • -s -> Use $SHELL to evaluate the command
  • -c -> Clear the screen before starting

To quit entr while it is running, press q
To execute the command immediately, press <space>

Read entr (1) for info on other options.

Check out a video tutorial on entr here:

Please check out my website and patreon

Discussion (0)

pic
Editor guide