Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

I want to run my command five times and print a count on each iteration
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: Script to run command multiple times
  • SDP: 6.4.1, 6.5.0
  • Target: Any supported target
________________________________________________________________________

Recommendation
________________________________________________________________________

Using a standard sh shell script, you can loop five times and on each iteration print the value of a counter, increment the count and run the command. Here is an example:

#!/bin/sh

count=0
while [ $count -lt 5 ]
do
count=`expr $count + 1`
echo $count
some_command
done

________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 None Found





Please contact us with your questions or concerns.