Practical Regex Building: The Regex to Match the Files part of a Unix-Like Command (ls)

This post is part of a practical series on regex (regular expressions) in a bash shell. Setup Let’s make a shell script. In your favourite editor type #!/bin/bash And save it somewhere as test.sh. Now we need to make it executable as follows: [ahmed@amayem ~]$ chmod +x ./testt.sh [ahmed@amayem ~]$ ./test.sh Looks good so far.…

Practical Regex Building: The Regex to Match the Options part of a Unix-Like Command (ls)

This post is part of a practical series on regex (regular expressions) in a bash shell. Setup Let’s make a shell script. In your favourite editor type #!/bin/bash And save it somewhere as test.sh. Now we need to make it executable as follows: [ahmed@amayem ~]$ chmod +x ./testt.sh [ahmed@amayem ~]$ ./test.sh Looks good so far.…