~strahinja/dotfiles

f3b5102378cf7e8f737edb1b294e197414d6a726 — Страхиња Радић 13 days ago 45693dc
bin/{t,c}sv*: Output usage after variable initialization

Signed-off-by: Страхиња Радић <contact@strahinja.org>
6 files changed, 21 insertions(+), 21 deletions(-)

M bin/csvdel
M bin/csvedit
M bin/csvins
M bin/tsvdel
M bin/tsvedit
M bin/tsvins
M bin/csvdel => bin/csvdel +4 -4
@@ 15,15 15,15 @@ error()
	exit $status
}

delim=${DELIM:-,}
prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

if [ $# -lt 3 ]; then
	usage
	exit 1
fi

delim=${DELIM:-,}
prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

[ -w "$1" ] || error 1 \`$1\' not writeable

cp "$1" "$tmpf"

M bin/csvedit => bin/csvedit +4 -4
@@ 17,15 17,15 @@ error()
	exit $status
}

delim=${DELIM:-,}
prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

if [ $# -lt 3 ]; then
	usage
	exit 1
fi

delim=${DELIM:-,}
prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

[ -w "$1" ] || error 1 \`$1\' not writeable
which vipe &>/dev/null || error 1 vipe not found


M bin/csvins => bin/csvins +4 -4
@@ 17,15 17,15 @@ error()
	exit $status
}

delim=${DELIM:-,}
prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

if [ $# -lt 1 -o $# -gt 2 ]; then
	usage
	exit 1
fi

delim=${DELIM:-,}
prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

which vipe &>/dev/null || error 1 vipe not found

touch "$1"

M bin/tsvdel => bin/tsvdel +3 -3
@@ 15,14 15,14 @@ error()
	exit $status
}

prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

if [ $# -lt 3 ]; then
	usage
	exit 1
fi

prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

[ -w "$1" ] || error 1 \`$1\' not writeable

cp "$1" "$tmpf"

M bin/tsvedit => bin/tsvedit +3 -3
@@ 17,14 17,14 @@ error()
	exit $status
}

prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

if [ $# -lt 3 ]; then
	usage
	exit 1
fi

prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

[ -w "$1" ] || error 1 \`$1\' not writeable
which vipe &>/dev/null || error 1 vipe not found


M bin/tsvins => bin/tsvins +3 -3
@@ 17,14 17,14 @@ error()
	exit $status
}

prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

if [ $# -lt 1 -o $# -gt 2 ]; then
	usage
	exit 1
fi

prog=$(echo $0 | sed 's@.*/\([^/]\+\)$@\1@g')
tmpf=$1~

which vipe &>/dev/null || error 1 vipe not found

touch "$1"