Skip to content

Instantly share code, notes, and snippets.

@rcmdnk
Last active December 4, 2016 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcmdnk/ba0b97f94b290ced8bc8ca6657981b9a to your computer and use it in GitHub Desktop.
Save rcmdnk/ba0b97f94b290ced8bc8ca6657981b9a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
. sentaku -n
_sf_s () {
output="$(_sf_nth $((_s_current_n))) value: ${_s_inputs[$_s_current_n]}
===============
"
if [ -f ${_s_inputs[$_s_current_n]} ];then
output="$output$(head -n $(($_s_lines-3)) ${_s_inputs[$_s_current_n]})"
else
output="$output${_s_inputs[$_s_current_n]} is not a file\n"
fi
_sf_echo "$output"
}
if [ -p /dev/stdin ];then
echo $(cat -) | _sf_main "$@"
else
_sf_main "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment