4 ms·
Isn't the >> going to cause urls.txt to grow geometrically? eg, copying http://example.com/foo http://example.com/foo and then http://example.com/bar http://ex
by dugmartin 5y ago
Isn't the >> going to cause urls.txt to grow geometrically?
eg, copying http://example.com/foo http://example.com/foo and then http://example.com/bar http://example.com/bar and then http://example.com/baz http://example.com/baz I think urls.txt would look like:
http://example.com/foo
http://example.com/foo
http://example.com/bar
http://example.com/foo
http://example.com/bar
http://example.com/baz
EDIT: I stand corrected. I should have run the code instead of mentally executing it.
One issue I did find when I ran it. The shebang should be:
#!/bin/bash
as [[ is a bash built-in. I'm on Ubuntu - maybe this works on Mac as /bin/sh is an alias to /bin/bash?
- BenjiWiebe 5y agoDoesn't look like it. The URLS variable could more appropriately be named CURRENT_URL. Singular, not plural.
- stevelosh 5y agoThe user might copy a block of text with multiple URLs, all of which get pulled out by the grep.
- deleted 5y ago[deleted]
- ktpsns 5y agoNo, >> is just doing appending, cf. https://wiki.bash-hackers.org/syntax/redirection#appending_redirected_output https://wiki.bash-hackers.org/syntax/redirection#appending_r...