shell script and c programming
I am trying to write a shell script and at a point the script launches a c program and how do I make the script to wait till that program is executed before executing the subsequent steps. As of now my script is not waiting until the program is completely executed and this is causing only a part of it being executed before the script completes execution
|
you should show us that script (or at least the important part). By default the shell waits for the programs until they are completed...
|
Quote:
#!/bin/bash ./finger/fingerprint /dev/ttyUSB0 /status.txt /template.txt; wait clear fingerstatus=`cat /root/status.txt` if [ "$fingerstatus" = "AUTH" ] then echo "successfully authinticated" else halt fi this is a part of my script which executes the compiled C program "fingerprint" and the next two lines are arguments passed to the program. This program when called communicates with a fingerprint device and tells if the finger is authenticated or not. This script runs as expected when called from a terminal but if included in the second stage of the boot process in init.d with symbolic links in rc2.d this script calls the program but exits before the program does its job. This is where I am stuck. |
Hm. Actually it depends on how the program fingerprint works. If it detaches itself from the terminal you will not be able to wait for it. If it will not detach, you will not need to wait, because the command itself will not return as long as a fingerprint was detected. You know which one is true. In either case the command wait is not needed.
Furthermore you entered /status.txt to the program but checked /root/status.txt. I think that should be the same file... |
Quote:
|
what about: echo -e "\x41"
echo -e "\x41" | <serial tty device> |
Quote:
|
yes, and you can send more data by:
echo -e "\x41\x42\x43" | <serial tty device> |
If the fingerprint command produced any output files you could wait for such files to become available. Like so:
Code:
while [ ! -f "outputfile.txt" ]; do |
All times are GMT -5. The time now is 09:52 PM. |