Last active
August 29, 2015 14:07
-
-
Save h3llborn/dda94685d679d2ab3504 to your computer and use it in GitHub Desktop.
assignment #2-q2
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 | |
echo "Number of arguments passed: $#" | |
X=0 # var used for while loop that increments every run | |
while [ $# -gt 0 ];do # check if we have more arguments | |
# check if $X number is even if so, print it | |
if [ `expr $X % 2` -eq 0 ]; then | |
echo $1 | |
shift # move onto next argument | |
X=`expr $X + 1` # increment loop counter | |
# if not even move to next argument and increase counter | |
else | |
shift | |
X=`expr $X + 1` | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment