linux - Executing an if statement after a specific output in expect script -
is there way execute if statement if see specific output? example, when console says "bad interpreter permission denied" want execute command "dos2unix file_name"? logic following,
if (output "bad interpreter permission denied") { send dos2unix file_name } fi
this expect script.
edit:
hi guys able in expect script?
if (grep -cim1 '^m$' lruload.sh) -eq 1; send dos2unix filename fi
how logic/psuedo-code?
export cmdtext=`mycmd param1 param2 2>&1` if ($cmdtext "bad interpreter permission denied") { send dos2unix file_name } fi
the permission denied text went stderr, not stdout, redirect 2>&1 lumps both of them together, making test simple.
Comments
Post a Comment