Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- haystack=`mv random1231 random112211 2>&1`
- needle="No such file or "
- case $needle in
- # match start of string
- $haystack*) echo yep, it matches at the start ;;
- # match end of string
- *"$haystack") echo yep, it matches at the end ;;
- # searchString can be anywhere in thisString
- *"$haystack"*) echo yep, it matches in the middle somewhere ;;
- *) echo Not found ;;
- esac
Add Comment
Please, Sign In to add comment