Skip to content

Instantly share code, notes, and snippets.

@sagan
Created December 6, 2012 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagan/4222004 to your computer and use it in GitHub Desktop.
Save sagan/4222004 to your computer and use it in GitHub Desktop.
更改OpenVPN端口。。蛋疼。。
#!/bin/sh
if [ $# -lt 2 ]
then
echo "Usage: change_openvpn_port <CONF_FILE> <PORT>"
exit 1
fi
sed -ire "s/^port[ \t]*[0-9]*/port $2/i" $1
sed -ire "s/^remote[ \t]*\([a-zA-Z0-9\.]*\)[ \t]*[0-9]*/remote \1 $2 /i" $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment