[g,f]
matches on either g
, ,
(comma) or f
. You'd need [fg]
for only f
or g
.
Now, technically.
mv public_html/*.??[gf] public_html/images/
Would also move a file called foo.x.f
as ?
also matches a .
.
Also, if there was no file matching that pattern, then some shells like bash
could move a file called literally *.??[gf]
(a bug introduced by the Bourne shell, fixed again in zsh
, you can work around it in bash
with shopt -s failglob
).
So, here for a 3 character extension that ends in f
or g
, that would be more, but still with that last caveat ([^.]
instead of [!.]
with some shells):
mv public_html/*.[!.][!.][fg] public_html/images/
For 3 letters:
mv public_html/*.[[:alpha:]][[:alpha:]][fg] public_html/images/
For with jpg, png or gif, with the zsh
shell:
mv public_html/*.(jpg|gif|png) public_html/images/
Or with ksh or zsh -o kshglob
or bash -O extglob
:
mv public_html/*.@(jpg|gif|png) public_html/images/
g
,,
(comma) org
" should be "g
,,
(comma) orf
", no? – EKons Apr 01 '18 at 17:00