huangcm
2025-08-25 f350412dc55c15118d0a7925d1071877498e5e24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
 
[ -f testing.sh ] && . testing.sh
 
#testing "name" "command" "result" "infile" "stdin"
 
HOST="$(cat /proc/sys/kernel/hostname)"
testing "get" "hostname" "$HOST\n" "" ""
 
if [ "$(id -u)" -ne 0 ]
then
  echo "$SHOWSKIP: groupdel (not root)"
  return 2>/dev/null
  exit
fi
 
testing "set" 'hostname "2>&1 | tee"; hostname; hostname "$HOST"' "2>&1 | tee\n" "" ""