source - execute commands from a file


source [-h] [-p] [-s] [-x] <file> [<args>]

Reads and executes commands from a file.

Command options:

-p
Prints a prompt before reading each command.
-s
Silently ignores an attempt to execute commands from a nonexistent file.
-x
Echo each command before it is executed.
<file>
File name
Arguments on the command line after the filename are remembered but not evaluated. Commands in the script file can then refer to these arguments using the history substitution mechanism.

EXAMPLE:

Contents of test.scr:

  read_model -i %:2
  flatten_hierarchy
  build_variables
  build_model
  compute_fairness
  
Typing "source test.scr short.smv" on the command line will execute the sequence

  read_model -i short.smv
  flatten_hierarchy
  build_variables
  build_model
  compute_fairness
  
(In this case %:0 gets "source", %:1 gets "test.scr", and %:2 gets "short.smv".) If you type "alias st source test.scr" and then type "st short.smv bozo", you will execute

  read_model -i bozo
  flatten_hierarchy
  build_variables
  build_model
  compute_fairness
  
because "bozo" was the second argument on the last command line typed. In other words, command substitution in a script file depends on how the script file was invoked. Switches passed to a command are also counted as positional parameters. Therefore, if you type "st -x short.smv bozo", you will execute
  read_model -i short.smv
  flatten_hierarchy
  build_variables
  build_model
  compute_fairness
  
To pass the "-x" switch (or any other switch) to "source" when the script uses positional parameters, you can define an alias. For instance, "alias srcx source -x".


Last updated on 990908 16h51