Re: '/bin/sh -c' with multiple args
Roland Illig <[email protected]> Thu, 4 Dec 2025 23:08:38 +0100
| Newsgroups | gmane.os.netbsd.devel.userlevel |
|---|---|
| Message-ID | <[email protected]> |
Am 04.12.2025 um 22:52 schrieb Jan Schaumann: > $ sh -c /bin/sleep whatever 30 > usage: sleep seconds That's a nice quiz question. It got me thinking, and after a few minutes of experimenting, I found the solution: > sh -c '/bin/sleep "$@"' whatever 30 The thing was that you ran the script "/bin/sleep" with $0 being "whatever" and $1 being 30, but the script didn't pass these arguments to the simple command "/bin/sleep". Roland