Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.