Last active
August 29, 2015 14:07
-
-
Save h3llborn/122523c2b72932e07daf to your computer and use it in GitHub Desktop.
assignment #2-q1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Author: Chris Niesel | |
# Class: Computer Science 2211A | |
# output the last argument passed to the script | |
# check if there are more than 0 argument | |
while [ $# -gt 0 ];do | |
# if current argument is the last one output it | |
if [ "$#" -eq 1 ]; then | |
echo $1 | |
exit 0 | |
# otherwise shift to the next one | |
else | |
shift | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment