×

INDI Library v1.7.8 Released (11 May 2019)

Mid year release of INDI Library v1.7.8 comes with a few drivers and improvements to to existing drivers.

Issue with indi_eval

  • Posts: 94
  • Thank you received: 7

Issue with indi_eval was created by Christian

Hi all,

I try to write a script that do a complete shutdown of my observatory. I use indi_getprop, indi_setprop and indi_eval for doing some action before the shutdown.

when i use indi_eval like this :
indi_eval -t 0 -w '"CCD Simulator.CCD_EXPOSURE._STATE"==1'
it do the job either in command line or in a shell script.

But, if i want use the same command with variable like this :

export INDI_CCD="CCD Simulator"
indi_eval -t 0 -wv '"$INDI_CCD.CCD_EXPOSURE._STATE"==1'

Compiling: "$INDI_CCD.CCD_EXPOSURE._STATE"==1
Connected to localhost on port 7624
sending getProperties for $INDI_CCD


it doesn't work because it cannot resolve the INDI_CCD variable. The problem is du to the single quote. I don't know how to resolve this issue.

Does some people have ever had this issue and how to correct it ?
2 weeks 5 days ago #38824

Please Log in or Create an account to join the conversation.

  • Posts: 122
  • Karma: 1
  • Thank you received: 69

Replied by pch on topic Issue with indi_eval

Yes, quoting variable in shell can be tricky.
Other can have better idea, but for me this work. Please note the unclose " in the export command, it is closed in the indi_eval command.
export INDI_CCD='"CCD Simulator'
indi_eval -t 0 -w  "$INDI_CCD"'.CCD_EXPOSURE._STATE"==1'
The following user(s) said Thank You: Christian
2 weeks 4 days ago #38846

Please Log in or Create an account to join the conversation.

  • Posts: 94
  • Thank you received: 7

Replied by Christian on topic Issue with indi_eval

thank you Patrick. With your advises i finished my script and yes, the bash variables are tricky to manipulate.
2 weeks 4 days ago #38853

Please Log in or Create an account to join the conversation.

Time to create page: 0.223 seconds