Taras Koroljuk wrote: > Hello. I have the simple c-code program called "program" wich opens > g-code file and inserts M8, M9 periodically. I turn on and turn off my > vacuum-cleaner by this program. > > Program executes with two parameters: -f FILENAME -p A1.A2 > > 1) FILENAME - file wich should be edit > 2) A1, A2 is the number of lines > > During the time of execution A1-lines vacuum-cleaner is working, and > for A2-lines cleaner is not working. I want to execute this program > from emc environment (from command line or during of g-code file > execution). I use user defined command M100 with arguments P- Q- for > this, P[FILENAME] Q[A1.A2]. > I put next lines in the file M100: > > #!/bin/bash > program -f 1$ -p 2$ > exit 0 > > So EMC must transmits parameters P Q as 1$ 2$ and executes file M100 > as bash script. Am I right? But this is not working. Please, help me > and forgive my bad English.
bash can be troubleshot at least two ways: - run with 'sh -x yourscript' or - use echo to show what it's supposed to happen I created script to include you commands as well as what I believe it should be: cat /tmp/test.sh #!/bin/bash echo program -f 1$ -p 2$ echo program -f $1 -p $2 echo "=====" echo program -f '$1:' [$1] -p '$2:' [$2] now run the following line: sh /tmp/test.sh 4 5 program -f 1$ -p 2$ program -f 4 -p 5 ===== program -f $1: [4] -p $2: [5] Last four lines are the result of the script. You need to change 1$ to $1. 'exit 0' is not needed. -- Rafael Skodlar ------------------------------------------------------------------------------ _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
