2020-09-06 16:34:40 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
path=${1:-~/.local/wine/top-speed-3/drive_c/Program\ Files/Playing\ in\ the\ dark/Top\ Speed\ 3}
|
|
|
|
echo "Enter URL or IP address for Top Speed 3 Server:"
|
|
|
|
read -r -e server
|
|
|
|
|
|
|
|
if ! [[ "${server}" =~ ^[0-9.]*$ ]]; then
|
|
|
|
ip="$( ping -c1 "${server}" 2> /dev/null | head -1 | cut -d '(' -f2 | cut -d ')' -f1)"
|
|
|
|
if [[ ${#p} < 3 ]]; then
|
|
|
|
echo "Ip address not found, nothing changed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
ip="${ip:-${server}}"
|
|
|
|
|
2020-09-06 16:42:52 -04:00
|
|
|
sed -i "s/^Multiplayer=.*/Multiplayer=${ip}/" "${path}/TopSpeed.cfg"
|
2020-09-06 16:34:40 -04:00
|
|
|
exit 0
|