Thank you very much in advance for helping!
I have this code in bash:
for d in this_folder/*
do
plugin=$(basename $d)
echo $plugin'?'
read $plugin
done
Which works like a charm. For every folders inside 'this_folder', echo it as a question and store the input into a variable with the same name.
But now I'd like to exclude some folders, so for example, it will ask for every folder in that directory, ONLY if they are NOT any of the following folders: global, plugins, and css.
Any ideas how can I achieve this?
Thanks!
UPDATE:
This is how the final code looks like:
base="coordfinder|editor_and_options|global|gyro|movecamera|orientation|sa"
> vt_conf.sh
echo "# ========== Base" >> vt_conf.sh
for d in $orig_include/@($base)
do
plugin=$(basename $d)
echo "$plugin=y" >> vt_conf.sh
done
echo '' >> vt_conf.sh
echo "# ========== Optional" >> vt_conf.sh
for d in $orig_include/!($base)
do
plugin=$(basename $d)
echo "$plugin=n" >> vt_conf.sh
done
Go to Start > Settings > Update & Security > Windows Security > Virus & threat protection. Under Virus & threat protection settings, select Manage settings, and then under Exclusions, select Add or remove exclusions. Select Add an exclusion, and then select from files, folders, file types, or process.
To loop through a directory, and then print the name of the file, execute the following command: for FILE in *; do echo $FILE; done.
The syntax to loop through each file individually in a loop is: create a variable (f for file, for example). Then define the data set you want the variable to cycle through. In this case, cycle through all files in the current directory using the * wildcard character (the * wildcard matches everything).
Method 1 : Using the option “-prune -o” We can exclude directories by using the help of “path“, “prune“, “o” and “print” switches with find command. The directory “bit” will be excluded from the find search!
You can use continue
to skip one iteration of the loop:
for d in this_folder/*
do
plugin=$(basename $d)
[[ $plugin =~ ^(global|plugins|css)$ ]] && continue
echo $plugin'?'
read $plugin
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With