#!/bin/bash set -e if [[ $# != 1 ]]; then echo "$0 " exit 1 fi function die() { echo "FAIL: $1" exit 1 } STRIP=$1 if [[ ! -r $STRIP ]]; then die "$STRIP is is not readable" fi output=$(echo "" | perl $STRIP) [[ "" == "$output" ]] || die "input=''" output=$(echo "hoge P I Y O" | perl $STRIP) [[ "hogePIYO" == "$output" ]] || die "input='hoge P I Y O'" echo "$0: OK"