Bash script that reads files in directory and processes them
I am trying to create a function within my .bashrc that will process all of the files that do not end with .sh within a directory and execute them.
The following is what I have so far. I am missing a way of excluding files that end with .sh though. function startall { for file in /etc/init.d/*.; do "${file}" start done } function stopall { for file in /etc/init.d/*.; do "${file}" stop done } I would appreciate any guidance on completing this. -Jim |
You can always add a check inside the loop. Something like:
Code:
for .....; do |
shopt -s extglob
ls !(*.sh) |
All times are GMT -5. The time now is 06:51 PM. |