Use printf instead of echo. exclude was unused.

This commit is contained in:
Jack L. Frost 2015-02-10 16:54:55 +03:00
parent 795078cb2b
commit 85cf56afc5

17
sup
View File

@ -13,11 +13,11 @@ cfg_screenshot_ext='png'
[[ -f $HOME/.suprc ]] && { source "$HOME/.suprc"; } [[ -f $HOME/.suprc ]] && { source "$HOME/.suprc"; }
sup.msg() { echo "[sup] $1"; } sup.msg() { printf '%s\n' "[sup] $1"; }
sup.err() { sup.msg "(error) $1" >&2; } sup.err() { sup.msg "(error) $1" >&2; }
sup.usage() { sup.usage() {
echo "Usage: ${_self} [-RsF] [-D num] [file/url]" printf '%s\n' "Usage: ${_self} [-RsF] [-D num] [file/url]"
} }
sup.env() { sup.env() {
@ -45,7 +45,7 @@ sup.mktemp() {
return 1 return 1
} }
echo "$1" printf '%s\n' "$1"
} }
sup.scrot() { sup.scrot() {
@ -67,15 +67,10 @@ sup.scrot() {
return 1 return 1
} }
echo "$tmp_file" printf '%s\n' "$tmp_file"
} }
sup.exclude() { sup.if_url() { printf '%s\n' "$1" | grep -oE "$cfg_url_regex" &>/dev/null; }
[[ "$2" ]] && { echo "$1"; return 1; }
return 0
}
sup.if_url() { echo "$1" | grep -oE "$cfg_url_regex" &>/dev/null; }
sup.mktemp() { sup.mktemp() {
declare tmp_file_name tmp_file_name_extra="$2" tmp_dir="$1" declare tmp_file_name tmp_file_name_extra="$2" tmp_dir="$1"
@ -89,7 +84,7 @@ sup.mktemp() {
tmp_file_name="${RANDOM}${RANDOM}${tmp_file_name_extra}" tmp_file_name="${RANDOM}${RANDOM}${tmp_file_name_extra}"
done done
echo "${tmp_dir}/${tmp_file_name}" printf '%s\n' "${tmp_dir}/${tmp_file_name}"
} }
set_argv() { set_argv() {