Hey I am working with shell scripting. I'm using bash under Debian 5.
I am trying to do simple math to find a percentage of files in a folder with a certain name. Anyway to simplify the explanation of what I am looking for, lets say im trying to find the percentage of files with the letter "A" in the name within a folder.
What I thought of to do is this, which finds all the files with "A" in the name, then counts the output lines which gives me the total number of files:
Code:
find . -iname "*A*" | wc -l
This is the only way I can think of to get that number. Now I want to work with that number by dividing it by the total number of files in that directory, which is not a static number; but for this case lets say its 50 files. How can I input that number to a variable that I can use to do the math?
I tried this:
Code:
count << find . -iname "*A*" | wc -l
and then I go into the programming functions of bash where I can write more lines of code, but thats the point I get lost.
Can anyone help me?