File: embed-envassert.sh

package info (click to toggle)
env-assert 0.015-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 424 kB
  • sloc: perl: 1,877; makefile: 8; sh: 7
file content (16 lines) | stat: -rwxr-xr-x 410 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env sh

# Get error when using unset (environment) variables.
set -u

# Ensure we have the required environment setup.
envassert --stdin <<'EOF'
NUMERIC_VAR=^[[:digit:]]+$
TIME_VAR=^\d{2}:\d{2}:\d{2}$
EOF

echo "${NUMERIC_VAR}: ${TIME_VAR}"
exit

# Run this example without installing the distribution:
# PERL5LIB=lib PATH="bin:${PATH}" NUMERIC_VAR=123 TIME_VAR=02:04:06 examples/embed-envassert.sh