1#!/bin/bash
2
3# Copyright 2014 Divya Kothari <divya.s.kothari@gmail.com>
4# Copyright 2014 Naha Maggu <maggu.neha@gmail.com>
5
6[ -f testing.sh ] && . testing.sh
7
8#testing "name" "command" "result" "infile" "stdin"
9
10# Get system hostname
11hostnameExe=`which hostname`
12hostnameOut=`$hostnameExe`
13
14# New hostname
15NewHostname="NewHostName.system"
16
17testing "Hostname - Get" "hostname" "$hostnameOut\n" "" ""
18testing "Hostname - Set, Get and then Reset" "hostname $NewHostname; hostname; hostname $hostnameOut; hostname" "$NewHostname\n$hostnameOut\n" "" ""
19