Recently Written · git

tmpl

Insanely simple templates

git clone https://github.com/equwal/tmpl

Log | Files | Refs


sh/echo-arg (247 bytes)

1 # Echo, fixed so only the first argument can be flags.
2 echo () (
3 fmt=%s end=\\n IFS=" "
4 
5 while [ $# -gt 1 ] ; do
6 case "$1" in
7 [!-]*|-*[!ne]*) break ;;
8 *ne*|*en*) fmt=%b end= ;;
9 *n*) end= ;;
10 *e*) fmt=%b ;;
11 esac
12 shift
13 done
14 
15 printf "$fmt$end" "$*"
16 )