Root/b2/test/subfn

1#!/bin/bash
2. ./Common
3
4###############################################################################
5
6tst "substitutions: F1 -> FN (expand \$\$)" -q F1=foo <<EOF
7!-s
8FN=* { RES=\$\$ }
9EOF
10
11expect <<EOF
12RES=foo
13EOF
14
15#------------------------------------------------------------------------------
16
17tst "substitutions: F2 -> FN (expand \$\$)" -q F1=foo F2=bar <<EOF
18!-s
19FN=?a? { RES=\$\$ }
20EOF
21
22expect <<EOF
23RES=bar
24EOF
25
26#------------------------------------------------------------------------------
27
28tst_fail "substitutions: F* -> FN (expand \$FN)" -q F1=foo <<EOF
29!-s
30FN=* { RES=\$FN }
31EOF
32
33expect <<EOF
34s:2: \$FN may be undefined
35EOF
36
37#------------------------------------------------------------------------------
38
39tst_fail "substitutions: assign to FN" <<EOF
40!-s
41FN=foo
42EOF
43
44expect <<EOF
45s:2: can't assign to pseudo-variable FN
46EOF
47
48###############################################################################
49

Archive Download this file

Branches:
master



interactive