I am storing command line parameters in an array variable. (This is necessary for me). I wanted to prefix all the array values with a string passing through a variable.
PREFIX="rajiv"
services=$( echo $* | tr -d '/' )
echo "${services[@]/#/$PREFIX-}"
I am getting this output.
> ./script.sh webserver wistudio
rajiv-webserver wistudio
But I am expecting this output.
rajiv-webserver rajiv-wistudio