Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6767383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:56:40+00:00 2026-05-26T14:56:40+00:00

I’m working with an embedded system running QNX that has a stripped-down shell (KSH).

  • 0

I’m working with an embedded system running QNX that has a stripped-down shell (KSH).

I want to locate all run all executables on the filesystem that match the following:

*/shle/*-*_test

The “shle” directory may appear up to 4 levels deep under root. My current approach is to run the following commands:

for shle in ./shle ./*/shle ./*/*/shle ./*/*/*/shle
do
  for exe in $shle/*-*_test
  do
    echo running: $exe
    $exe
  done
done

Is there a cleaner or faster way of doing this? Are there commands other than grep and find that I should try?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:56:41+00:00Added an answer on May 26, 2026 at 2:56 pm

    If you don’t have find, you can’t do much better than what you did: enumerate the levels. If you needed to go down to arbitrary levels, you could do it with a recursive function (but watch out, recursion is tricky when all you have is global variables). Fortunately, with a known maximum depth, it’s a lot simpler.

    There’s a little room for improvement: you’d better put double quotes around all variable substitutions, in case there’s a filename somewhere that contains whitespace or special characters. And you aren’t testing whether $exe is exists and executable (it could be the pattern …/*-*_test if that pattern doesn’t match anything, or perhaps it could be a non-executable file).

    for shle in shle */shle */*/shle */*/*/shle; do
      for exe in "$shle"/*-*_test; do
        test -x "$exe" && "$exe"
      done
    done
    

    If you don’t even have test (if you have ksh, it’s built-in, but if it’s a stripped-down shell it might be missing), you might get away with a more complicated test to see if the pattern was expanded:

    for shle in shle */shle */*/shle */*/*/shle; do
      for exe in "$shle"/*-*_test; do
        case "$exe" in
          */"*-*_test") :;;
          *) "$exe";;
        esac
      done
    done
    

    (I’m suprised that you don’t have find, I thought QNX came with a full POSIX suite, but I’m unfamiliar with the QNX ecosystem, this could be a stripped-down version of the OS for a small device.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.