If I run:
for f in *1000.png
echo $f
end
I get
1000.png
11000.png
21000.png
I would like to do something like:
for i in 1 2 3
for f in *$i000.png
echo $f
end
end
To get
1000.png
11000.png
21000.png
2000.png
12000.png
22000.png
3000.png
13000.png
23000.png
Instead, it outputs nothing.
I also tried:
for i in 1 2
set name "*"$i"000.png"
for f in (ls $name)
echo $f
end
end
Outputting:
ls: *1000.png: No such file or directory
ls: *2000.png: No such file or directory
To avoid trying to expand the variable $i000
, you would do
for i in 1 2 3
for f in *{$i}000.png
echo $f
end
end
Or, avoid the outer loop altogether:
for f in *{1,2,3}000.png
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