I am trying to parse the IP address from ifconfig command. It works fine when I do it on the command line

```
pb791b@pb791b-VirtualBox:~/devtest/ngs/base/Tests/shellScripts$ ifconfig enp0s3 | sed -n '/inet addr/s/.*addr.\([^ ]*\) .*/\1/p'
192.168.1.112

```

But it gives error when I use it in a expect script.

```
#!/usr/bin/expect 

set pidBash [ spawn bash ]

set ipIfConfig {ifconfig enp0s3 | sed -n '/inet addr/s/.*addr.\([^ ]*\) .*/\1/p'}
set clientIP [exec "echo $ipIfConfig"]
puts "clientIP = $clientIP" 
exit 1

```

The output is

```
pb791b@pb791b-VirtualBox:~/devtest/ngs/base/Tests/shellScripts$ ./ifconfig_parse.sh 
spawn bash
couldn't execute "echo ifconfig enp0s3 | sed -n '/inet addr/s/.*addr.\([^ ]*\) .*/\1/p'": no such file or directory
    while executing
"exec "echo $ipIfConfig""
    invoked from within
"set clientIP [exec "echo $ipIfConfig"]"
    (file "./ifconfig_parse.sh" line 7)

```