I'm getting sed: -e expression #1, char 35: unterminated s' command when I try and run the following script. Any ideas?

#/bin/bash
#
#
# This script is to be used to re-write a configuration file
# replacing select values, SSID, IP, device name, gateway,
# and frequency with the supplied command line arguments.
#
# example: ./configure input-file, SSID, IP, device-name, gateway, frequency
#
#
FILE=${1}
SSID=${2}
IP=${3}
DEVICE=${4}
GATEWAY=${5}

sed -e 's/\(wireless\.1\.ssid=\).*/\${SSID}'             \
    -e 's/192\.168\.1\.20$/${IP}/g'                      \
    -e 's/\(NanoBridge M.\)/\${DEVICE}/g'                \
    -e 's/\(route\.1\.gateway=\).*/\${GATEWAY}/g' ${FILE} > /home/garrett/Desktop/NEW-CONFIG.txt
#END#

Recommended Answers

All 4 Replies

I think you wanted this:

 's/\(wireless\.1\.ssid=\).*/\${SSID}'

to be this:

 's/\(wireless\.1\.ssid=\).*/\${SSID}/g'

I removed the /g and I got the same thing.

I removed the /g

You mean "added", right?

Yea, thanks. Now it's actually replacing the text the the strings "${SSID}", "${DEVICE}", etc. Any further input?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.