62 lines
837 B
Bash
62 lines
837 B
Bash
#!/bin/sh
|
|
|
|
_ROKU_SHELL_DIR=$(dirname $(realpath $(readlink -f "${BASH_SOURCE[0]}" )))
|
|
source $_ROKU_SHELL_DIR/_roku_shared.sh
|
|
source $_ROKU_SHELL_DIR/_roku_completion.sh
|
|
|
|
roku()
|
|
{
|
|
_roku_dispatch "$@"
|
|
}
|
|
|
|
complete -F __roku_completion roku
|
|
|
|
|
|
###############################################################################
|
|
#
|
|
# Logging
|
|
#
|
|
LOGDIR="${HOME}/roku/logs"
|
|
|
|
|
|
dcapture()
|
|
{
|
|
nc minicom "$@" -C $LOGDIR/.log.$(date +%Y-%m-%d--%H-%M-%S)
|
|
}
|
|
|
|
|
|
dfile()
|
|
{
|
|
local Nth="-1"
|
|
if [ $# -gt 0 ]; then
|
|
Nth="$1"
|
|
fi
|
|
|
|
echo $(ls -tr -1 ${LOGDIR}/minicom.log.* | tail ${Nth} | head -1)
|
|
}
|
|
|
|
dless()
|
|
{
|
|
less $(lfile "$@")
|
|
}
|
|
|
|
dcat()
|
|
{
|
|
cat $(lfile "$@")
|
|
}
|
|
|
|
dgrep()
|
|
{
|
|
lcat | grep -a --color "$@"
|
|
}
|
|
|
|
dtail()
|
|
{
|
|
if [ $# -gt 0 ]; then
|
|
tail -f $(lfile) | grep "$@"
|
|
else
|
|
tail -f $(lfile)
|
|
fi
|
|
}
|
|
|