hostname.test 330 B

123456789101112
  1. #!/bin/bash
  2. [ -f testing.sh ] && . testing.sh
  3. #testing "name" "command" "result" "infile" "stdin"
  4. HOST="$(cat /proc/sys/kernel/hostname 2>/dev/null)"
  5. skipnot [ $? -eq 0 ]
  6. testing "get" "hostname" "$HOST\n" "" ""
  7. skipnot [ $(id -u) -eq 0 ]
  8. testing "set" 'hostname "2>&1 | tee"; hostname; hostname "$HOST"' "2>&1 | tee\n" "" ""