Last active
March 14, 2018 10:48
-
-
Save EvgenyOrekhov/a944b455dcb70db32ad10acaaa9a1444 to your computer and use it in GitHub Desktop.
POSIX shell scripting challenge
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 | |
set -eu | |
FILES=$(find . -maxdepth 1 -type f | sort) | |
# -------------- # | |
# FIX ME # | |
# vvvvvvvvvvvvvv # | |
./test.sh $FILES |
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
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 | |
set -e | |
EXPECTED_1='./challenge.sh' | |
EXPECTED_2='./space .sh' | |
EXPECTED_3='./test.sh' | |
if [ "$1" = "$EXPECTED_1" ] && [ "$2" = "$EXPECTED_2" ] && [ "$3" = "$EXPECTED_3" ]; then | |
echo 'OK' | |
else | |
echo 'FAIL' | |
echo "Expected 3 arguments: $EXPECTED_1 $EXPECTED_2 $EXPECTED_3" | |
echo "Received $# argument$([ $# -ne 1 ] && echo 's'): $*" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment