Regular Expressions 101

Community Patterns

Match shell (sh / bash) shebangs

0

Regular Expression
Python

r"
^#!(/usr)?/bin/(env )?(ba)?sh$
"
gm

Description

This matches shell shebangs (bash / sh). It could be used e.g. to find shell files (via grep -m1 -EIrl '<exp>').

Submitted by anonymous - 3 years ago