1 | |
---|
2 | source - execute commands from a file |
---|
3 | _________________________________________________________________ |
---|
4 | |
---|
5 | source [-h] [-p] [-s] [-x] <file> [<args>] |
---|
6 | |
---|
7 | Reads and executes commands from a file. |
---|
8 | |
---|
9 | Command options: |
---|
10 | |
---|
11 | -h |
---|
12 | Print the command usage. |
---|
13 | |
---|
14 | -p |
---|
15 | Print a prompt before reading each command. |
---|
16 | |
---|
17 | -s |
---|
18 | Silently ignore an attempt to execute commands from a nonexistent |
---|
19 | file. |
---|
20 | |
---|
21 | -x |
---|
22 | Echo each command before it is executed. |
---|
23 | |
---|
24 | <file> |
---|
25 | File name |
---|
26 | |
---|
27 | Arguments on the command line after the filename are remembered but not |
---|
28 | evaluated. Commands in the script file can then refer to these arguments |
---|
29 | using the history substitution mechanism. |
---|
30 | |
---|
31 | EXAMPLE: |
---|
32 | |
---|
33 | Contents of test.scr: |
---|
34 | |
---|
35 | read_blif_mv %:2 |
---|
36 | init_verify |
---|
37 | simulate -n 10 |
---|
38 | |
---|
39 | |
---|
40 | Typing "source test.scr lion.mv" on the command line will execute the |
---|
41 | sequence |
---|
42 | |
---|
43 | read_blif_mv lion.mv |
---|
44 | init_verify |
---|
45 | simulate -n 10 |
---|
46 | |
---|
47 | |
---|
48 | (In this case %:0 gets "source", %:1 gets "test.scr", and %:2 gets |
---|
49 | "lion.mv".) If you type "alias st source test.scr" and then type "st |
---|
50 | lion.blif bozo", you will execute |
---|
51 | |
---|
52 | read_blif_mv bozo |
---|
53 | init_verify |
---|
54 | simulate -n 10 |
---|
55 | |
---|
56 | |
---|
57 | because "bozo" was the second argument on the last command line typed. In |
---|
58 | other words, command substitution in a script file depends on how the script |
---|
59 | file was invoked. Switches passed to a command are also counted as |
---|
60 | positional parameters. Therefore, if you type "st -x lion.mv bozo", you will |
---|
61 | execute |
---|
62 | read_blif_mv lion.mv |
---|
63 | init_verify |
---|
64 | simulate -n 10 |
---|
65 | |
---|
66 | |
---|
67 | To pass the "-x" switch (or any other switch) to "source" when the script |
---|
68 | uses positional parameters, you can define an alias. For instance, "alias |
---|
69 | srcx source -x". |
---|
70 | _________________________________________________________________ |
---|
71 | |
---|
72 | Last updated on 20100410 00h02 |
---|