From 2c3be9f7ce18e00622b9bf3283b89c33a90f6950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Wed, 4 Mar 2020 11:45:14 +0100 Subject: [PATCH] change beep --- functions.sh | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/functions.sh b/functions.sh index cc0e905..bf7996c 100644 --- a/functions.sh +++ b/functions.sh @@ -490,27 +490,50 @@ EOF } turnoffbeep() { - line='set bell-style none' + changebeep none +} + +changebeep() { + case $1 in + none) + style=visible + ;; + visible) + style=visible + ;; + audible) + style=audible + ;; + *) + echo "usage: changebeep [none|visible|audible]" + return 1 + ;; + esac + line='set bell-style' file=~/.inputrc - [ -e "$file" ] && grep -qxF "$line" "$file" || echo "$line" >> "$file" + if [ -e "${file}" ] ; then + sed -i -e "/$line/d" "${file}" + fi + echo "${line} ${style}" >> "${file}" + return 0 } turnoffconfigsync() { line='MYSHELLCONFIG_GIT_SYNC=' file=~/.bashrc - if [ -e "$file" ] ; then - sed -i -e "/$line/d" "${file}" + if [ -e "${file}" ] ; then + sed -i -e "/${line}/d" "${file}" fi - sed -i -e "/#MYSHELLCONFIG-start/i${line}false" "$file" + sed -i -e "/#MYSHELLCONFIG-start/i${line}false" "${file}" } turnonconfigsync() { line='MYSHELLCONFIG_GIT_SYNC=' file=~/.bashrc - if [ -e "$file" ] ; then - sed -i -e "/$line/d" "${file}" + if [ -e "${file}" ] ; then + sed -i -e "/${line}/d" "${file}" fi - sed -i "/#MYSHELLCONFIG-start/i${line}true" "$file" + sed -i "/#MYSHELLCONFIG-start/i${line}true" "${file}" } #EOF