Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Running a shell command and saving the response to a variable

I have a bunch of directories, named like this:

  • 5553_DirHere
  • 5554_DirHere
  • 5555_DirHere

How can I run a shell command, to find all directories with the name "5554"?

The shell script would be something like:

find /mnt/Desktop -type d -name "5554*"

Then save the output to a variable

This is what I have tried:

const getDownloadPath = name => {
const folderDir = 5554;
  exec('find /mnt/Desktop -type d -name ${folderDir}*', function(err, stdout, stderr)
 {
 if(err) console.error(stderr);
 const singleFolder = stdout;
 });
   return `${config.path}/${stdout}`;
 };
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

'Find' command can be slow when searching larger directories. I used file-system, which works perfectly.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!