Guest User

Untitled

a guest
Mar 14th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.41 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. haystack=`mv random1231 random112211  2>&1`
  4. needle="No such file or "
  5.  
  6.  
  7. case $needle in
  8.   # match start of string
  9.   $haystack*) echo yep, it matches at the start ;;
  10.  
  11.   # match end of string
  12.   *"$haystack") echo yep, it matches at the end ;;
  13.  
  14.   # searchString can be anywhere in thisString
  15.   *"$haystack"*) echo yep, it matches in the middle somewhere ;;
  16.  
  17.   *) echo Not found ;;
  18. esac
Add Comment
Please, Sign In to add comment