From cbf22e631a6e5b9129a95b192a29c8215e9917ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Wed, 31 Aug 2022 19:26:39 +0300 Subject: imgurl: use a different file name to avoid file name too long errors --- dotfiles/.local/bin/imgurl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dotfiles/.local/bin/imgurl b/dotfiles/.local/bin/imgurl index f9cad49..c594712 100755 --- a/dotfiles/.local/bin/imgurl +++ b/dotfiles/.local/bin/imgurl @@ -2,5 +2,8 @@ [ -z "$1" ] && exit -setsid curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && nsxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & +base="$(basename $1)" +ext="${base##*.}" +fname="/tmp/imgurl-$(date '+%s').$ext" +setsid curl -sL "$1" > "$fname" && nsxiv -a "$fname" & -- cgit v1.2.3