Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ string="hello-world"
- $ prefix="hell"
- $ suffix="ld"
- $ #remove "hell" from "hello-world" if "hell" is found at the beginning.
- $ prefix_removed_string=${string/#$prefix}
- $ #remove "ld" from "o-world" if "ld" is found at the end.
- $ suffix_removed_String=${prefix_removed_string/%$suffix}
- $ echo $suffix_removed_String
- o-wor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement