Is there any way to execute small bash snippets in the shell?
If you don't want to edit a file again and again and test it by executing it again and again (in fact by jumping forth and back between two programs: editor and shell), you might want to execute small code snippets (maybe as strings) in the shell directly.
For example testing a regular expression or any part of an if-condition:
"hi =~ "h". OK, the result of this might be obvious, but there are more complicated cases for one, two or three liner.
So, none of these ways, because, AFAIK
bash -x executes files and
eval executes commands only.