Adding comma between command line parameter
All parameters is $@
. You can use sed
to replace spaces with commas and then(or from the begining, cut
the first field)
echo $@ | sed s/" "/,/g | cut -d "," -f2-
a step forward, you can assign it to a variable:
comma_separated_params=`echo $@ | sed s/" "/,/g | cut -d "," -f2-`