function gztar()
{
[ -d "$1" ] || { echo "usage: gztar <dir> [tar options]" 1>&2; exit 1; }
- DIR="$1"
+ local DIR="$1"
shift
tar "$@" -czvf "$(basename "$DIR").tar.gz" "$DIR"
}
function bztar()
{
[ -d "$1" ] || { echo "usage: bztar <dir> [tar options]" 1>&2; exit 1; }
- DIR="$1"
+ local DIR="$1"
shift
tar "$@" -cjvf "$(basename "$DIR").tar.bz2" "$DIR"
}
function xztar()
{
[ -d "$1" ] || { echo "usage: xztar <dir> [tar options]" 1>&2; exit 1; }
- DIR="$1"
+ local DIR="$1"
shift
tar "$@" -cJvf "$(basename "$DIR").tar.xz" "$DIR"
}
then
function aptitude-remove-dep()
{
+ local PACKAGES
PACKAGES=$(apt-cache showsrc "$1" | grep Build-Depends | perl -p -e 's/(?:[\[(].+?[\])]|Build-Depends:|,|\|)//g')
sudo aptitude markauto "$PACKAGES"
}
then
function record()
{
+ local TIMESTAMP
TIMESTAMP="$(date '+%Y-%m-%d-%H:%M:%S')"
# The trick here is to use 'type' to eat any leading environment variables
# and get to the command name.
+ local COMMAND_NAME
COMMAND_NAME="$(type -P "$@" 2>/dev/null | cut -d ' ' -f 1)"
[ "x$COMMAND_NAME" = "x" ] && return 1
# Escape the argument so that it can be reused as shell input
# NOTE: this is Bash specific.
+ local COMMAND_ESCAPED
COMMAND_ESCAPED=$(printf "%q " "$@")
script -q -e -c "$COMMAND_ESCAPED" "${TIMESTAMP}_$(basename "$COMMAND_NAME").log"