I want to replace "." in this result: "172.16.0.25" with " dot ".
Here is my code:
#!/bin/bash
connection=`netstat -tn | grep :1337 | awk '{print $5}' | cut -d: -f1`
#this returns "172.16.0.25"
replace=" dot "
final=${connection/./$replace}
echo "$final"
Which returns: test.sh: 4: test.sh: Bad substitution
I tried using tr '.' ' dot '
but that only replaced the '.' with a space (' ')
I know this is a really dumb question, but I'm new to Shell Script.
Also, if it changes anything, I'm on a Raspberry Pi 2 running Raspbian.