I am running these commands to modify a few files
Code:
/bin/sed -i -e "s/ClientX/$client/g" /etc/hosts
/bin/sed -i -e "s/ClientX/$client/g" /etc/hostname
/bin/sed -i -e "s/5040/$port/g" /etc/beatbox/start
/bin/sed -i -e "s/generic/$group/g" /etc/beatbox/start
/bin/sed -i -e "s/ClientX Not Defined/$client/g" /etc/passwd
The files are modified, but where the output of the variables should be, there's only empty space. For example/etc/hostname is empty. It should have the output of $client.
I know my variables are ok because I get the output below.
Code:
if [ -z "$port" ]; then echo "var is unset"; else echo "var is set to '$port'"; fi
var is set to '5074'
root@ClientX:~# if [ -z "$group" ]; then echo "var is unset"; else echo "var is set to '$group'"; fi
var is set to 'generic'
root@ClientX:~# if [ -z "$client" ]; then echo "var is unset"; else echo "var is set to '$client'"; fi
var is set to 'Client024'
Is my sed syntax wrong?