• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Bash loop on files in folder without specific pattern

Resolved: Bash loop on files in folder without specific pattern

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have to cycle over the files present in a folder but I dont want to cycle over files with a specific pattern (“Reverse”). Here is the code
Thanks
I Also have another minor problem. When i printf outdirs=%s the variable that is printed is $outputDir that starts with a “/” but after it got printed by printf, looks like the / is not there anymore.

Answer:

Your awk command puts spaces $b, so $outputDirs will contain spaces. Therefore, you need to quote it to make it a single argument to printf. You should also quote all the other variable arguments.
Also, since you’re creating a perl command line, you’ll want outdir=%s to be a single argument, so you should put single quotes around that as well.
To skip files with Reverse in the name, enable extended globbing and use a non-matching pattern.

If you have better answer, please add a comment about this, thank you!

bash for-loop
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Passing 2 functions in onChange in react

24/03/2023

Resolved: Why doesn’t stringstream consume output during hex formatting?

24/03/2023

Resolved: CMake path for python3 libraries doesn’t change (windows 10)

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.