Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ jobs:
- shell: /bin/dash
- shell: /bin/bash
- shell: /bin/zsh
- awk: /usr/bin/original-awk
- awk: /usr/lib/freebsd/awk
- awk: /usr/bin/gawk
- awk: /usr/bin/mawk
- awk: /usr/bin/nawk
- os: macos-latest
shell: /bin/sh
- os: macos-latest
shell: /bin/bash
runs-on: ${{ matrix.os || 'ubuntu-20.04' }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
env:
ESH_SHELL: ${{ matrix.shell }}
ESH_AWK: ${{ matrix.awk }}
steps:
- uses: actions/checkout@v2

- run: sudo apt-get install freebsd-glue original-awk zsh
if: runner.os == 'Linux'
- run: sudo apt-get install zsh
if: runner.os == 'Linux' && matrix.shell == '/bin/zsh'

- run: make test
3 changes: 3 additions & 0 deletions esh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ function end_text() {
state = "UNDEF"
}
function process_line() {
if (linenos[depth] == 0 && match(buff, "^#! */usr/bin/env esh([ \t]|$)")) {
return
}
print_nl = 1
linenos[depth]++

Expand Down
2 changes: 2 additions & 0 deletions esh.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ Opening and closing tag may not be at the same line.
Text outside a tag becomes literal text, but it is subject to any tagged shell code surrounding it.
For example, text surrounded by a tagged *if* statement only appears in the output if the condition is true.

If the first line of the template starts with `#!/usr/bin/env esh`, this line will be removed from the output (since 0.4.0).


== EXAMPLES

Expand Down
2 changes: 2 additions & 0 deletions tests/incl/esh-shebang.esh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#! /usr/bin/env esh
This line is included from incl/esh-shebang.esh
1 change: 1 addition & 0 deletions tests/test-esh-shebang.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello from esh-shebang!
2 changes: 2 additions & 0 deletions tests/test-esh-shebang.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env esh
Hello from <%= ${TEST_NAME#test-} %>!
1 change: 1 addition & 0 deletions tests/test-include-esh-shebang.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This line is included from incl/esh-shebang.esh.
2 changes: 2 additions & 0 deletions tests/test-include-esh-shebang.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env esh
<%+ incl/esh-shebang.esh %>.