# test.esh # Test file for esh, the example Unix shell # Author: Douglas W. Jones, July 22, 2003 V4.0 # # To use this script, type, for examle, the following # under a more fully developed Unix shell: # esh < test.esh /bin/echo execute /bin/echo -- file executed directly echo execute echo -- file executed using search path echo echo next, we test the who command, /usr/bin/who first, then who /usr/bin/who who echo echo next, we test an error bizarreunknowncommand echo echo next, we try to set the environment variable TESTVAR setenv TESTVAR value_of_TESTVAR echo echo next, we try to list the value of TESTVAR # the following bit of shell scripting uses tcsh to extract and list # the variable. It's awful, because our shell doesn't yet support # quoted strings as single arguments, so we had to make a real kluge # here! tcsh -c $argv eval echo $TESTVAR echo echo next, we demonstrate what happens if setenv is used incorrectly setenv setenv too many arguments echo echo next, we change PATH to .:/bin setenv PATH .:/bin echo echo having done this, the command who will fail (it needs /usr/bin in PATH) who echo echo now we change PATH to .:/usr/bin:/bin setenv PATH .:/usr/bin:/bin echo echo now we test to see that it now finds who in /usr/bin/. who echo echo End of test!