Three streams
Processes commonly read standard input (0), write ordinary output to standard output (1) and write diagnostics to standard error (2). A pipe connects stdout to the next process’s stdin.
Trace a pipeline
cat app.log | grep "error" | head -n 5 reads a file, filters matching lines and shows the first five. You could avoid cat with grep "error" app.log | head -n 5. Neither example writes a file, but log contents may be sensitive.
A file is not a pipe
> writes to a file and normally truncates it. >> appends. Never assume a command failed before the shell opened its redirected output file. Avoid reading and redirecting into the same file.
Know the exit status
In Bash, a pipeline normally reports the status of its final command. With pipefail enabled, a nonzero status from an earlier stage can affect the result. Shell settings and programs differ; inspect the whole pipeline.
Your next step
Pick one command from your agent’s last explanation. Identify its purpose, target and possible side effects before deciding whether to run it.