--- lastproofread: '2026-03-16' --- (command-scripting)= # Command scripting VyOS supports executing configuration and operational commands non-interactively from shell scripts. To include VyOS-specific functions and aliases, source the `/opt/vyatta/etc/functions/script-template` file at the beginning of your script. ```none #!/bin/vbash source /opt/vyatta/etc/functions/script-template exit ``` ## Script execute permissions Simply placing script files in `/config/scripts/` does not mean the system can execute them. To make your scripts executable, grant them **execute permissions**. Use the following command: ```none chmod +x /config/scripts/script-name.sh ``` ## Run configuration commands In scripts, present configuration commands as in a standard configuration session. For example, to disable a BGP peer during a VRRP transition to the backup state, use the following syntax: ```none #!/bin/vbash source /opt/vyatta/etc/functions/script-template configure set protocols bgp system-as 65536 set protocols bgp neighbor 192.168.2.1 shutdown commit exit ``` ## Run operational commands In scripts, **always** prefix operational commands with `run`. ```none #!/bin/vbash source /opt/vyatta/etc/functions/script-template run show interfaces exit ``` ## Run commands remotely You can execute multiple **operational commands** on a remote VyOS system by passing a script block over SSH. ```none ssh 192.0.2.1 'vbash -s' <