Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use an OSX Terminal session to start a VPN connection. The command that I execute at the prompt is:

/etc/netlock/cvc -c ::

This works as expected.

I would like to save this to a script file that I can simply double-click to start.

I created a file, 'vpn.command', added the command (list above), save it, and given execute permission:

chmod +x vpn.command

When I double-click the file, Terminal opens a BASH shell, executes the command, then exits. Upon closer inspection, the command is now '/etc/netlock/cvc -c ::; exit;'

Why is the extra '; exit;' appended to my command?

BTW, is there a way to execute another command, /etc/netlock/cvc -d, when the Terminal session is being closed so I can close the VPN automatically?

share|improve this question

I altered my command file to resemble the following:

#! /bin/bash

echo 'connecting...'
/etc/netlock/cvc -c connection:account:password

read -p "Press a key to disconnect."

echo 'disconnecting...'
/etc/netlock/cvc -d
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.