zjnyly
zjnyly

Reputation: 365

How to pass parameter for build-in commands in bash?

I want to pass some parameters through xargs, but as some bash commands like cd, wait are build-in commands, xargs can't find them, so how can I pass the parameter to these commands?

For example, I expect this script to output ls results 60s later:

sleep 60 &
pgrep sleep | wait;
ls

But wait seems can't receive the pid, because I tried pgrep sleep | echo and prints nothing, so the script displays the ls result immediately without waiting.

Upvotes: 0

Views: 54

Answers (1)

Diego Torres Milano
Diego Torres Milano

Reputation: 69358

Why not just

sleep 60 && ls

Upvotes: 1

Related Questions