tAdd ext2gopher. - scripts - random scripts
HTML git clone https://git.parazyd.org/scripts
DIR Log
DIR Files
DIR Refs
---
DIR commit 0c1b24ac7fdbfdd272644ba47cfe8fdd973868e9
DIR parent 933852ecce46bffbae79861a41c6213a2440105e
HTML Author: parazyd <parazyd@dyne.org>
Date: Tue, 19 May 2020 02:28:04 +0200
Add ext2gopher.
Diffstat:
A ext2gopher | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)
---
DIR diff --git a/ext2gopher b/ext2gopher
t@@ -0,0 +1,23 @@
+#!/bin/sh
+
+if [ -z "$1" ]; then
+ printf "usage: %s filename|extension" "$(basename "$0")"
+ exit 1
+fi
+
+ext="$(printf "%s" "$1" | awk -F. '{print $NF}')"
+
+case "$ext" in
+ jpg|jpeg|JPG|JPEG|png|PNG)
+ echo "I"
+ ;;
+ gif|GIF)
+ echo "g"
+ ;;
+ txt|TXT|vtt|VTT|vt|VT|ebuild|sh|c|md|html|HTML|css)
+ echo "0"
+ ;;
+ *)
+ echo "9"
+ ;;
+esac