dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 6007bf6b7b2a4e966b1e1779ab97dbe2488716cf
parent 8acc3c62da2ceded76acb5e0078791322a2b32e0
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue,  7 Jul 2020 22:53:54 +0200

hurlo(): accept urls as arguments or from stdin

Diffstat:
M.profile | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/.profile b/.profile @@ -116,11 +116,16 @@ alias date-uk='TZ=Europe/London date' alias date-israel='TZ=Israel date' hurlo() { - out="${1##*/}" - [ -z "$out" ] && out="hurl_out" - [ -f "$out" ] && { printf 'error: %s exists\n' "$out" >&2; return 1; } - hurl "$1" > "$out" - printf '%s\n' "$out" + if [ "$#" -lt 1 ]; then + cat + else + printf '%s\n' "$@" + fi | while read -r url; do + [ -z "$out" ] && out="hurl_out" + [ -f "$out" ] && { printf 'error: %s exists\n' "$out" >&2; return 1; } + hurl "$url" > "$out" + printf '%s\n' "$out" + done } alias w3m='w3m -B'