File: dh-exec-subst-env

package info (click to toggle)
dh-exec 0.31
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 324 kB
  • sloc: ansic: 530; perl: 178; makefile: 126; sh: 67
file content (7 lines) | stat: -rwxr-xr-x 358 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
#! /usr/bin/perl -wnp
##
## This does nothing else, but substitute ${...} with the
## corresponding environment variable, or the original ${...} if the
## env. var does not exist.
s/(\$\{([^\}]+)\})/exists $ENV{$2} ? $ENV{$2} : $1/eg;
s/(\$\{env:([^\}]+)\})/exists $ENV{$2} ? $ENV{$2} : die(qq{Cannot expand "${1}" as the ENV variable "${2}" is unset.})/eg;