Timeline for Counting file extensions in a string array
Current License: CC BY-SA 4.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 16, 2022 at 9:03 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 153 characters in body
|
| Apr 16, 2022 at 8:57 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 153 characters in body
|
| Apr 16, 2022 at 8:52 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 153 characters in body
|
| Apr 16, 2022 at 8:32 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 336 characters in body
|
| Apr 16, 2022 at 8:24 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 364 characters in body
|
| Apr 16, 2022 at 8:08 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 213 characters in body
|
| Apr 16, 2022 at 7:22 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
edited body
|
| Apr 16, 2022 at 7:15 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 2 characters in body
|
| Apr 15, 2022 at 18:48 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 931 characters in body
|
| Apr 15, 2022 at 18:40 | comment | added | Stéphane Chazelas |
@Nemdr, <<< ${FILES[*]} feeds the concatenation of the elements of the array with the first character of $IFS to grep -c (or worse in older versions of bash where that was subject to splitting before joining). So unless you have run IFS=$'\n' or some file names contain newline characters, grep will only get one line of input. And again, as I said that won't work properly if file names contain newline characters.
|
|
| Apr 15, 2022 at 18:34 | comment | added | Nemdr |
This seems to work: nrofjpg=$( grep -c '\.jpg$' <<< ${FILES[*]} ) The grep -c in your comment was the key it seems
|
|
| Apr 15, 2022 at 18:28 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 14 characters in body
|
| Apr 15, 2022 at 18:21 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 78 characters in body
|
| Apr 15, 2022 at 18:13 | history | answered | Stéphane Chazelas | CC BY-SA 4.0 |