Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

Invoke-VMScript. Pass variable in BASH

$
0
0

Hi LUCD, hi all!

Small script to change IP in CentoS

 

 

$IPguest = Read-Host -Prompt 'Enter IP Guest'
$script = "sed -i 's:^IPADDR=.*$:IPADDR=$IPguest:g' /etc/sysconfig/network-scripts/ifcfg-ens160"
Invoke-VMScript -VM CentOS-7 -ScriptType bash -ScriptText $script -GuestUser root -GuestPassword P@ssw0rd

 

Error:sed: -e expression #1, char 13: unterminated `s' command

The problem here: $:IPADDR=$IPguest.

How can I pass variable in this case?


Viewing all articles
Browse latest Browse all 175326

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>