Re:Studio Ghibli releases 400 free-to-use images
by rootsudo on Wednesday September 23, 2020 @08:13AM
(#24566047)
I did not know I could do {001...999} with wget! wow!
[ Parent
| on HN ]
Re:Studio Ghibli releases 400 free-to-use images
by pxndxx on Wednesday September 23, 2020 @08:14AM
(#24566058)
That's a shell feature, not wget's.
Re:Studio Ghibli releases 400 free-to-use images
by jasonjayr on Wednesday September 23, 2020 @02:21PM
(#24570182)
Curl has it built in:
curl -O 'https://example.org/[2-4].jpg'
(quotes disable any kind of shell expansion)
Re:Studio Ghibli releases 400 free-to-use images
by lohfu on Wednesday September 23, 2020 @08:19AM
(#24566099)
Really? I thought the shell could only expand globs if it matches files on the local file system?
Re:Studio Ghibli releases 400 free-to-use images
by lloeki on Wednesday September 23, 2020 @08:32AM
(#24566212)
The feature is called brace expansion:
https://www.gnu.org/software/bash/manual/html_node/Brace-Exp...
You may also be interested in yet another powerful feature that is parameter expansion:
https://www.gnu.org/software/bash/manual/html_node/Shell-Par...
Filename expansion (nitpick: often mistaken for globbing) is performed last:
https://www.gnu.org/software/bash/manual/html_node/Filename-...
Re:Studio Ghibli releases 400 free-to-use images
by account42 on Thursday September 24, 2020 @03:25AM
(#24576189)
> nitpick: often mistaken for globbing
What exactly would you call globbing if not the feature that is controlled using the nullglob, failglob, nocaseglob and dotglob options as well as the GLOBIGNORE variable.
Re:Studio Ghibli releases 400 free-to-use images
by lloeki on Thursday September 24, 2020 @04:03AM
(#24576408)
Globbing has an ambivalent definition given that it’s mostly used for filename matches (especially given its origin as the glob command), but it’s really a specific form of pattern matching using wildcards such as * and ?, it need not apply only to filenames or paths on the filesystem: this matching is also used to match strings in case/in/esac constructs and test’s == !=
https://www.gnu.org/software/bash/manual/bash.html#Condition...
I guess one could say globbing is applying this pattern matching to filter a list.
Re:Studio Ghibli releases 400 free-to-use images
by falcor84 on Wednesday September 23, 2020 @08:23AM
(#24566134)
You're right regarding glob functionality, but the curly braces are a separate shell feature. The most useful idiom I use it for is renaming or copying, e.g.:
cp filename{,_backup}
Re:Studio Ghibli releases 400 free-to-use images
by ses1984 on Wednesday September 23, 2020 @08:20AM
(#24566114)
Thoae aren't globs, if you put an asterisk there it would not work.
Re:Studio Ghibli releases 400 free-to-use images
by barrkel on Wednesday September 23, 2020 @09:46AM
(#24566984)
Of course, this only works well with non-ancient bash, not the ancient version which ships with MacOS, which will do {1.999} but can't do the leading zeros (you can use printf '%.3d' as a separate step).
Re:Studio Ghibli releases 400 free-to-use images
by kawera on Wednesday September 23, 2020 @10:26AM
(#24567439)
brew is your friend here, it has the latest version. Works well.
Re:Studio Ghibli releases 400 free-to-use images
by moonchild on Wednesday September 23, 2020 @04:49PM
(#24571854)
Afaik macos ships with zsh now, which supports that feature.
Re:Studio Ghibli releases 400 free-to-use images
by SparkyMcUnicorn on Wednesday September 23, 2020 @08:17AM
(#24566084)
It isn't bound by command. You can use it everywhere!