0
send "if [ `ps -ef | grep ttyS1 | sed -n 1p | cut -d ' ' -f 2` -eq 'ttyS1' ]; then
not_found='false'
else 
not_found='true'
fi\r"

I have tried so many time with double quote and single quote also under ttyS1 but it is showing 1) ttyS1: unknown operand 2) Bad Number for double quote

0

You use -eq which is for comparing numbers. Your = when you compare strings

send "if [ `ps -ef | grep ttyS1 | sed -n 1p | cut -d ' ' -f 2` = 'ttyS1' ]; then
not_found='false'
else 
not_found='true'
fi\r"

And you can use double quotes as they are used already. You can also leave string ttyS1 w/o any quotes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.