tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: '/bin/sh -c' with multiple args
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
Home |
Main Index |
Thread Index |
Old Index