@vaporeon_ do you know find? purrticularly -exec?
@vaporeon_ fur using multiple arguments in the same command you just add a + after the {}, e.g., find . -type f -exec grep pattern '{}' +
@vaporeon_ it's shell syntax, so yes
{ echo hi; cat file } >file2
@aescling Doesn't work for me in Bash, needs to be { echo hi; cat file; } >file2 for it to work... ( echo hi; cat file ) >file2 works, though... Can you tell me what the difference between these and the other brackets is? I don't know...
@vaporeon_ god i keep furgetting when the final semicolon is necessary
{} runs the commands in the current shell; () runs them in a subshell
if you can spare the extra purrocess,
(
cd dir
[...]
)
is a convenient pattern
@aescling What happens if I don't? I just attempted to execute find . -type f -exec grep -H abcd {} \; on a directory containing files that have whitespaces in their names, and it still worked fine...
@vaporeon_ really? i’m pretty sure that should be a syntax error. huh
@aescling Wait. Should I be quoting the
{}? I genuinely forgot... (Also, does the command you just wrote not need a\;at the end, after the+?)