News for hackers. Stuff that matters.
Re:Show HN: Sempl – Stupid Simple Bash Templating by bashinator on Thursday October 08, 2015 @06:00PM (#10356626)
How is this different from GNU envsubst (in the gettext package)?
Re:Show HN: Sempl – Stupid Simple Bash Templating by nextrevision on Thursday October 08, 2015 @06:13PM (#10356721)
envsubst will really just perform variable substitution, not perform any logic or command substitution (e.g. $(hostname -f)). It's also limited, from what I've seen, in support for other bash variable actions (such as defaults). You can also write loops with output similar to other templating languages here as well.
Re:Show HN: Sempl – Stupid Simple Bash Templating by pdkl95 on Thursday October 08, 2015 @09:41PM (#10357619)
Traditionally, this would be a job for m4:

    $ cat examples/config.yaml.in 
    user: USERNAME
    password: ifelse(PASSWORD,`PASSWORD',`defaultpass',PASSWORD)
    files:
    patsubst(esyscmd(`ls'), `.+$', `  - \&')

    $ m4 -DUSERNAME=somebody examples/config.yaml.in
    user: somebody
    password: defaultpass
    files:
      - README.m4
      - examples
      - sempl