#!/bin/bash # script: record # purpose: execute the given command and record all output including escape codes to the given file # author: Florian Loeffler # site: http://www.geek-blog.de/projekte/bash2html # copyright: licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License # (see http://creativecommons.org/licenses/by-nc-sa/3.0/) # version: 0.1 if (( $# < 2 )); then echo -ne "Usage: record.sh [command] [record_file]\n" exit 1 fi if [ -e $2 ]; then echo -ne "WARNING!! File '$2' already exists.\n" exit 2 fi /bin/bash -c "$1" | tee $2