I'm trying to use all arguments from my function like this
function docker_run {
docker run \
-it --rm \
--entrypoint "" \
--volume "$(pwd):/${repo}" \
--workdir "/${repo}" \
alpine/git:v2.26.2 \
"$*"
}
docker_run sh -c "git reset && git add --a && git status"
this gives the error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: "sh -c git reset && git add --a && git status": executable file not found in $PATH": unknown.
if I remove quotes around $*
the error is:
usage: git [--version] [--help] [-C ]...
is *$
the correct variable to use? ideally I'd want docker_run
to work with any possible argument combination