Find does not work in Expect Send command

Posted by Sharjeel Sayed on Stack Overflow See other posts from Stack Overflow or by Sharjeel Sayed
Published on 2010-03-24T10:22:20Z Indexed on 2010/03/24 10:23 UTC
Read the original article Hit count: 531

Filed under:
|
|
|
|

I run this bash command to display contents of somefile.cf in a Weblogic domain directory.

find $(/usr/ucb/ps auwwx | grep weblogic | tr ' ' '\n' | grep security.policy | grep domain | awk -F'=' '{print $2}' | sed -e 's/weblogic.policy//' -e 's/security\///' -e 's/dep\///' | awk -F'/' '{print "/"$2"/"$3"/"$4"/somefile.cf"}' | sort | uniq) 2> /dev/null -exec ls {} \; -exec cat {} \;

I tried incorporating this in an expect script and also escaped some special characters which would throw an error in expect but its still not working.

send "echo ; echo 'Weblogic somefile.cf:' ; find \$(/usr/ucb/ps auwwx | grep weblogic | tr ' ' '\n' | grep security.policy | grep domain | awk -F'=' '{print \$2}' | sed -e 's/weblogic.policy//' -e 's/security\\///' -e 's/dep\\///' | awk -F'/' '{print "/"\$2"/"\$3"/"\$4"/somefile.cf"}' | sort | uniq) 2> /dev/null -exec ls {} \\; -exec cat {} \\; ; echo\r"

I guess it needs some more escaping of special characters or probably I dint escape the existing ones correctly. Any help would be appreciated.

© Stack Overflow or respective owner

Related posts about expect

Related posts about bash