Created
June 18, 2020 13:27
-
-
Save kristiannissen/a5451fe6006f304e9e75446dbb749ed7 to your computer and use it in GitHub Desktop.
Bash as a template language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Reference https://devhints.io/bash | |
| // If statements | |
| if [[1+1=2]] then | |
| echo "String is empty" | |
| elif [[1+1=3]] then | |
| echo "String is not empty" | |
| fi | |
| ^(if|elif)\s\[\[(.*)\]\]\s(then)$ // With T${1}E1${2}S${3} as replacement matches | |
| TifE11+1=2Sthen | |
| echo "String is empty" | |
| TelifE11+1=3Sthen | |
| echo "String is not empty" | |
| fi | |
| \s(echo)\s"?(.*)"? // With T${1}E${2} as replacement matches | |
| TechoEString is empty | |
| // Also matches | |
| echo $1 | |
| ^(fi) // With T${1} as replacement matches | |
| TFI | |
| for i in /etc/rc. do | |
| echo $i | |
| done | |
| ^(for)\s(.*)\s(do)$ // With T${1}E${2} as replacement matches | |
| TforEi in /etc/rc. | |
| ^(done) // With T${1} as replacement matches | |
| Tdone | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment