Reputation: 318
In trying to create a bash function which accepts arguments and passes them to another command I am encountering a problem in quoting the parameters correctly.
I am defining the following function:
function cluster () {
dsh -acM -- \'"$@"\';
}
The usage of this command being to translate something like cluster ls -l
to dsh -acM -- 'ls -l'
.
Thanks for your time.
Upvotes: 0
Views: 57
Reputation: 531075
You can just use
cluster () {
dsh -acM -- "$*"
}
so that dsh
gets a single string for the last argument.
Upvotes: 1