mirror of
https://github.com/mgree/ffs.git
synced 2024-08-17 07:10:35 +03:00
41 lines
777 B
Bash
41 lines
777 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
fail() {
|
||
|
echo FAILED: $1
|
||
|
if [ "$MNT" ]
|
||
|
then
|
||
|
rm -r "$MNT"
|
||
|
fi
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
MNT=$(mktemp -d)
|
||
|
|
||
|
unpack --into "$MNT" ../json/object.json || fail unpack
|
||
|
|
||
|
cd "$MNT"
|
||
|
case $(ls) in
|
||
|
(eyes*fingernails*human*name) ;;
|
||
|
(*) fail ls;;
|
||
|
esac
|
||
|
[ "$(cat name)" = "Michael Greenberg" ] || fail name
|
||
|
[ "$(cat eyes)" -eq 2 ] || fail eyes
|
||
|
[ "$(cat fingernails)" -eq 10 ] || fail fingernails
|
||
|
[ "$(cat human)" = "true" ] || fail human
|
||
|
touch jokes
|
||
|
[ -f jokes ] || fail touch
|
||
|
case $(ls) in
|
||
|
(eyes*fingernails*human*jokes*name) ;;
|
||
|
(*) fail ls2;;
|
||
|
esac
|
||
|
mkdir recipes
|
||
|
[ -d recipes ]|| fail mkdir
|
||
|
case $(ls) in
|
||
|
(eyes*fingernails*human*jokes*name*recipes) ;;
|
||
|
(*) fail ls3;;
|
||
|
esac
|
||
|
cd - >/dev/null 2>&1
|
||
|
|
||
|
pack "$MNT" || fail pack
|
||
|
rm -r "$MNT" || fail mount
|