2021-07-29 05:44:12 -07:00
|
|
|
#!/usr/bin/env dash
|
2021-07-29 00:37:35 -07:00
|
|
|
# YES_ZSH
|
2021-07-29 05:44:12 -07:00
|
|
|
# YES_BASH
|
|
|
|
# YES_DASH
|
2021-09-23 06:48:05 -07:00
|
|
|
# YES_ASH
|
|
|
|
|
|
|
|
# works with busybox ash.
|
2021-07-29 00:37:35 -07:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
slit() { ### @-
|
|
|
|
### view specific columns of text.
|
2021-07-29 05:44:12 -07:00
|
|
|
[ $# -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:,:):-\$${^@}} }"
|
2021-07-29 00:37:35 -07:00
|
|
|
}
|
|
|
|
|
2021-08-02 13:48:46 -07:00
|
|
|
[ -n "${preload+-}" ] || slit "$@"
|