Skip to content

Instantly share code, notes, and snippets.

@EvgenyOrekhov
Last active March 14, 2018 10:48
Show Gist options
  • Save EvgenyOrekhov/a944b455dcb70db32ad10acaaa9a1444 to your computer and use it in GitHub Desktop.
Save EvgenyOrekhov/a944b455dcb70db32ad10acaaa9a1444 to your computer and use it in GitHub Desktop.
POSIX shell scripting challenge
#!/bin/sh
set -eu
FILES=$(find . -maxdepth 1 -type f | sort)
# -------------- #
# FIX ME #
# vvvvvvvvvvvvvv #
./test.sh $FILES
#!/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