Home > Software design >  Open program with a script
Open program with a script

Time:02-22

I need some help. How do I run a command in a shorter way. Let me try and explain. I have openVPN install on a headless system. If I want to disable it I have to /usr/local/etc.... stop. Can I write like a script in the root directory called lets say "OpenVPN stop" and then it runs the /usr/local/etc/... command?

Thanks for your help in advance

CodePudding user response:

you can create bash alias. Example:

alias OpenVPN="/usr/local/etc/... $1"

Where $1 is the placeholder for the argument you give after OpenVPN command

CodePudding user response:

  1. Please reffer enter image description here

    1. alias need to be defined before you start your script in ~/.bashrc otherwise you may get "command not found" error

    2. define functions and use them

    fn_vpns () { /usr/local/rc.d/openvpn start }
    fn_vpns
    
  • Related