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 |
---|
19 | nonexistent 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 |
---|
28 | not evaluated. Commands in the script file can then refer to these |
---|
29 | arguments 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. |
---|
58 | In other words, command substitution in a script file depends on how |
---|
59 | the script file was invoked. Switches passed to a command are also |
---|
60 | counted as positional parameters. Therefore, if you type "st -x |
---|
61 | lion.mv bozo", you will 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 |
---|
68 | script uses positional parameters, you can define an alias. For |
---|
69 | instance, "alias srcx source -x". |
---|
70 | _________________________________________________________________ |
---|
71 | |
---|
72 | Last updated on 20050519 10h16 |
---|