Merge branch '2-suppress-autoattach-output' into 'master'

Resolve "Suppress autoattach output"

Closes #2

See merge request lhprojects-information-network/scripts!2
This commit is contained in:
Lutchy Horace 2021-01-26 21:30:10 -05:00
commit 95901b3805
1 changed files with 19 additions and 6 deletions

View File

@ -14,12 +14,26 @@ function write_setting
fi fi
} }
function is_tmux_running
{
if [ -n "${TMUX}" ]; then
return 0
fi
return 1
}
function debug
{
if ! is_tmux_running; then
echo $1
fi
}
function attach_session function attach_session
{ {
if [ -n "${TMUX}" ]; then if is_tmux_running; then
exit 1 exit 0
fi fi
tmux attach -t $1 2> /dev/null tmux attach -t $1 2> /dev/null
@ -61,7 +75,6 @@ function usage
exit 0 exit 0
} }
# Load configuration file # Load configuration file
test -f $CONF_FILE && . $CONF_FILE test -f $CONF_FILE && . $CONF_FILE
@ -70,8 +83,8 @@ PLATFORM='unknown'
unamestr=$(uname) unamestr=$(uname)
case "$unamestr" in case "$unamestr" in
OpenBSD* ) OpenBSD* )
echo "*BSD OS detected!!" debug "*BSD OS detected!!"
echo "Long options is disabled!!" debug "Long options is disabled!!"
OPTS=`getopt chgs: $*` OPTS=`getopt chgs: $*`
set_opts_exit_status=$? set_opts_exit_status=$?
PLATFORM=$unamestr ;; PLATFORM=$unamestr ;;