The exec command executes commands from a file as if the user typed or pasted the input into the MD-CLI.
Use the following syntax to execute commands from a file.
[ex:/configure]
A:admin@node-2# exec ?
[url] <string>
<string> - <0..255 characters>
Location of the file to be executed
[ex:/configure]
A:admin@node-2# exec my-url-fn ?
exec
echo - Display the commands as they are being executed
The exec command:
errors if it detects an interactive input
terminates in the CLI engine in which it completes execution as follows:
If there are no commands that switch CLI engines, the CLI engine is always the one in which exec started.
If there are commands that switch CLI engines, exec ends in the last CLI engine that was entered.
//exec returns to the engine in which it was started.
terminates execution and displays an error message if an error occurs, leaving the session in the same context as when the error occurred
The system executes the file as follows:
disables pagination while the command is running
disables command completion while the command is running
suppresses the commands in the file from the command history
When using commands that switch between CLI engines within an executable file, the following commands are recommended:
Use /!classic-cli to switch explicitly to the classic CLI engine and /!md-cli to switch explicitly to the MD-CLI engine, instead of // to toggle between engines.
Use exit all to get to a known starting point: the operational root of the classic CLI or the MD-CLI engine.
Include edit-config if the script needs to change the candidate configuration in the MD-CLI engine. Use quit-config after changes are committed in the script.
An executable with edit-config may fail if other users have locked the configuration.
Issuing the quit-config command with changes in the candidate configuration while the session is in exclusive configuration mode fails the executable because of the ‟discard changes” prompt.