3 ms·
I've never seen/used xargs (/export) like: export $(sudo cat <protected_credentials_file> | xargs) Is that the same as sudo cat f | xargs export? If so,
by OJFord 5y ago
I've never seen/used xargs (/export) like:
export $(sudo cat <protected_credentials_file> | xargs)
Is that the same as sudo cat f | xargs export?
If so, I think an important difference is that mine won't hide the exit code, and you can then answer a sibling commenter (on forgetting without checking) with 'I omitted set -e at the top'.
- jedbrown 5y agoexport is a shell builtin -- it can't be executed by xargs and even if it could, wouldn't be in the context of the shell you want.
- OJFord 5y agoTrue. `sh -c export` then, with `set -o allexport` ;)
- gizdan 5y agoThe sibling comment said. It looks like in this example it's used simply to trim whitespace. E.g. $ echo ' hello ' | xargs hello