I need to insert an array of arguments into an eval
string executed via bash -c
.
In this particular case, it's not possible to pass them separately as proper arguments (it's for an flock
invocation which doesn't accept arguments for a -c
script).
Smth like this:
flock f.lock -c 'do_stuff '"${ARGS[@]}"'; do_other_stuff'
How do I quote them properly so that they are correctly parsed into a sequence of arguments, even if they contain spaces or Bash special syntax?