Shell script testing

Some time ago I had to test several shell scripts how they affect the running environment on Linux.

I ended up writing this simple script to help testing. This example script runs testsubject.sh script, and shows changes to enviroment variables the script causes.


!/bin/bash
#
# Script to handle file sending to server
#
env > env.1
set > set.1
#
source "testsubject.sh"
#
env > env.2
set > set.2
echo "Environment:"
sdiff -s env.1 env.2 |cut -d">" -f2
echo "Variables:"
sdiff -s set.1 set.2 |cut -d">" -f2
#
rm set.1 set.2 env.1 env.2

0 Comments

Be the first to post a comment.

Leave a Comment

Your email address will not be published. Required fields are marked *

*

*