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.
The tools are developed under Linux with
release early, release often
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.
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"; fiPlease 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"; doneOption -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.
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 -
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.