On Sat, Apr 30, 2016 at 10:45 PM, Eric Vidal <[email protected]> wrote: > It is possible to have a zsh/bash and execlineb syntax on the same file? With some work yes. By default any execline script plays nice with interstitial programs that only do chain loading. So programs like nice, time, etc are all fine. It does not play nice with programs that terminate, however it provides the foreground and background programs to handle that. > > For example : > #!/bin/execlineb -P > > if [ -d /run/example ]; then > s6-mkdir -m 0755 /run/example > fi Not an execline script, this is pure shell with an alternate mkdir implementation. Using the execline interpreter is wrong here. > > or > > #!/bin/execlineb -P > > if { s6-test -d /run/example } > mkdir -m 0755 /run/example This is fine. The execline if program chain loads into the next program if its test passes, and while mkdir (and s6-mkdir) are not chain loading programs, as long as it is the last program in the script it doesn't matter. If you wanted to have the script do more work after the mkdir, you would need to rewrite your script as follows: #!/bin/execlineb -P if {s6-test -d /run/example } foreground { mkdir -m 0755 /run/example } rest_of_program
foreground is used to wrap a normal, terminating program with one that understands how to exec and is commonly used when a discrete one-shot program is needed within an execline program. Cheers! -Colin -- "If the doors of perception were cleansed every thing would appear to man as it is, infinite. For man has closed himself up, till he sees all things thru' narrow chinks of his cavern." -- William Blake
