Tag: scripts

bash ansi codes to html for html reports from shell script

How many times you have felt that there was some simple way to convert bash ansi escape sequences ( colors as well in terminal ) to html equivalent so that you can send the same as html report in email. Here is simple solution. One way is to use ccze if you are using this for logs – colorize your logs and for more generic solution.

 

dnf install python3-ansi2html.noarch

after this is installed, you can use something like this:

/usr/bin/python3-ansi2html -l -f 12 -i

You can see the help for ansi2html to see what parameters mean and which ones suit you best 🙂

ShellCheck – check basic POSIX shell script errors

Here is description of the tool:

Description : The goals of ShellCheck are:
:
: * To point out and clarify typical beginner’s syntax issues,
:   that causes a shell to give cryptic error messages.
:
: * To point out and clarify typical intermediate level semantic
:   problems, that causes a shell to behave strangely and
:   counter-intuitively.
:
: * To point out subtle caveats, corner cases and pitfalls, that may
:   cause an advanced user’s otherwise working script to fail under
:   future circumstances.

To install

dnf install ShellCheck

And just run the tool on the script to get the common errors.

nall – schedule your tasks like a pro

nall is a utility to run your scripts ( for whatever ) every defined period. Here is description:

Description : Nall is a small gtk+ application that discretely fits into your freedesktop
: system tray (such as trayer).
:
: Its purpose is to spawn periodically every kind of script and display a
: one-line output in the tooltip window. The main usage of nall is monitoring or
: just notifying of almost everything (it just depends upon your imagination and
: ability to script).

For installation :

sudo yum install nall

Once done, you can start from terminal as “nall” or create a autostart file “~/.config/autostart/nall.desktop” to start it automatically when you log in :

[Desktop Entry]
Type=Application
Exec=/usr/bin/nall
Hidden=false
NoDisplay=true
X-GNOME-Autostart-enabled=true
Name[en_US]=nall
Name=nall
Comment[en_US]=nall
Comment=nall