[jump to content][No Software Patents]Tools (new) : printansi [ Home | Scylla+Charybdis old home | Tools (old) | Tools (new) | FAQ | Downloads ]

Moving to GitHub, slowly

The software on this pages will slowly be moved to GitHub https://github.com/hilbix/. The CVS repository will be migrated to GIT as well, so the history will be preserved, a bit. See FAQ.

Scylla and Charybdis, printansi - Tools

The tools are developed under Linux with ESR's paradigm release early, release often in mind.
So you can consider this beta software, or alpha, or pre-alpha, or even worse ;)

Have a look in the download directory for all downloads.
As always here, all you get is the source. No binaries here.

printansi 0.1.0-20100112-032113

Like /bin/echo but ANSI-escapes the output


⇒ ⇒ ⇒ The development shifted to another location. All future versions will be published at https://github.com/hilbix/printansi   ⇐ ⇐ ⇐


Printansi echos the arguments to stdout (or a file) ANSI-escaped. The arguments are separated by spaces and ends the line with LF.

This way you can preserve the arguments between shell sessions, by reading them in again. Example:

a='arg with
newline'
b="arg with shell '"'" shell'
printansi "$a" "$b" > /tmp/preserve.file.$$
read -r c d < /tmp/preserve.file.$$
eval c="\$'$c'"
eval d="\$'$d'"
if [ ".$a" = ".$c" ] || [ ".$b" != ".$d" ]; then echo "fail"; fi
Please note that the "read" and "eval" completely runs in the shell without any forks, so it's quick.

If you invoke it with -f it automatically creates and locks the file.

Options -l when combined with option -f are a quick version of following line:

while read -r a; do printansi -f "file" "$a"; done
Option -z is the same with NUL as line terminator.

I want to stress, that you must use read -r. If you forget the option -r you will see strange effects.

History:

version 0.1.0-20100112-032113

download (244127 bytes) sig

Options -d and -r added

Also possible race condition removed.

Now printansi can be used as a save logfile, like in

for a do echo "start $a" process "$a" echo "finished $a: $?" done | # Log lines "[YYYYMMDD-HHMMSS][PID] stdin" printansi -drp "[$$]" -lf logfile.out -

version 0.0.0-20090827-202636

download (244423 bytes) sig

First version, nearly untested.

As there is a new unit (io.h for put.h) in tinoLib, there might be grave bugs. We will see.

License and Disclaimer

All you can see here is free software according to the GNU GPL.
Copyright (C)2000-2011 by Valentin Hilbig
Note that the software comes with absolutely no warranty of any kind.
You use the software at your own risk.
Valentin Hilbig cannot be hold responsible for any unintended damage,
lost data or malfunction of the software you can find here.

[FSFE contributor 2007]

[end of page - jump back to content][hacker culture]
Last modified: 2011-09-12 by Valentin Hilbig [ Imprint / Impressum ]