1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-26 09:07:12 -07:00
rc/sh/slit

19 lines
404 B
Bash
Executable File

#!/usr/bin/env dash
# YES_ZSH
# YES_BASH
# YES_DASH
# YES_ASH
# works with busybox ash.
slit() { ### @-
### view specific columns of text.
[ $# -gt 0 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
awk "{ print $(printf ',$%s' $@ | cut -b2-) }"
# via: https://github.com/sorin-ionescu/prezto/
#awk "{ print ${(j:,:):-\$${^@}} }"
}
[ -n "${preload+-}" ] || slit "$@"