diff options
author | Alexey Gladkov <gladkov.alexey@gmail.com> | 2021-08-19 10:11:24 +0000 |
---|---|---|
committer | Alexey Gladkov <gladkov.alexey@gmail.com> | 2021-10-05 13:57:49 +0200 |
commit | c008cbb20e162f7d4efcf9e7013e4309a42311c9 (patch) | |
tree | 577a62c92b554435af80af571f6a6d52ef8eb6e4 | |
parent | d90806bbd8b9ccafd62ea51de9b4de7ff0acdf73 (diff) | |
download | kbd-c008cbb20e162f7d4efcf9e7013e4309a42311c9.tar.gz |
fix some issues in scripts identified using shellcheck
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
-rwxr-xr-x | src/cad | 2 | ||||
-rwxr-xr-x | src/unicode_start | 12 | ||||
-rwxr-xr-x | src/unicode_stop | 6 |
3 files changed, 10 insertions, 10 deletions
@@ -46,7 +46,7 @@ if [ $? = 0 ];then dont_panic " Shutting down in 2 minutes" /sbin/shutdown -r +2 "sistema esta en shutdown" -else +else sleep 1 dialog --infobox " diff --git a/src/unicode_start b/src/unicode_start index d5234a8d..f1f3f0b0 100755 --- a/src/unicode_start +++ b/src/unicode_start @@ -1,7 +1,7 @@ #!/bin/sh # 0. Check whether we're on a console -TTY="`/usr/bin/tty`" +TTY=$(/usr/bin/tty) case "$TTY" in /dev/console|/dev/vc*|/dev/tty[0-9]*) ;; @@ -34,17 +34,17 @@ kbd_mode -u # not the global keymap. root will have to load the keymap in unicode mode # explicitly. -uid="`id -u 2>/dev/null`" ||: -if [ "$uid" = '0' ]; then +uid="$(id -u 2>/dev/null)" ||: +if [ "$uid" = 0 ]; then # There is no way of reverting the effect of "dumpkeys | loadkeys --unicode", # the memory of the earlier keymap is lost. Therefore, try # to save a copy of the original keymap to be able to reload it in unicode_stop. # (see also http://mail.nl.linux.org/linux-utf8/2003-08/msg00053.html): - [ -n "$HOME" -a "$HOME" != '/' ] || + [ -n "$HOME" ] && [ "$HOME" != '/' ] || HOME='/root' - if [ -d "$HOME" -a -w "$HOME" ]; then + if [ -d "$HOME" ] && [ -w "$HOME" ]; then [ -d "$HOME/.kbd" ] || mkdir -- "$HOME/.kbd" @@ -62,7 +62,7 @@ fi # Tell the console output driver that the bytes arriving are UTF-8 # encoded multibyte sequences. -if [ -t 1 -a -t 2 ]; then +if [ -t 1 ] && [ -t 2 ]; then printf '\033%%G' fi stty iutf8 diff --git a/src/unicode_stop b/src/unicode_stop index 07a8e4bf..ed57d10e 100755 --- a/src/unicode_stop +++ b/src/unicode_stop @@ -1,6 +1,6 @@ #!/bin/sh -TTY="`/usr/bin/tty`" +TTY=$(/usr/bin/tty) case "$TTY" in /dev/console|/dev/vc*|/dev/tty[0-9]*) ;; @@ -17,8 +17,8 @@ if test -t ; then fi stty -iutf8 -uid="`id -u 2>/dev/null`" ||: -if [ "$uid" = '0' ]; then +uid="$(id -u 2>/dev/null)" ||: +if [ "$uid" = 0 ]; then [ ! -r "$HOME/.kbd/.keymap_sv" ] || loadkeys "$HOME/.kbd/.keymap_sv" fi |