Commas in alias filter

I’m using a provision script to configure several instances of a hotspot service called CoovaChilli. There is a parameter that takes comma separeted values and I don’t know how to put that in the alias filter of the declare statement. Here is what i got:

function addNewProfile(profile) { return declare(path + `[` + `Disable:,` + `Net:${},`+ `UAMListen:${profile.uam_listen},`+ `UAMServer:${profile.uam_server},`+ `UAMAllowed:\'${profile.uam_allowed}\',`+ `UAMDomain:${profile.uam_domain},`+ `SSID:${profile.ssid}`+ `]`, {}, {path:1}); }

The problem is that profile.uam_allowed looks something like, and the declare function reads it as if I’m stating a new parameter. I have tried escaping it with backslash and putting it in single quotes but no success. I’d really appreciate any suggestion.

Hi, just use double quotes … plus, I personally avoid string concatenation and use string templates, so you can rewrite the code like this:

function addNewProfile(profile) { 
return declare(`${path}[Disable:,Net:"${}",UAMListen:"${profile.uam_listen}",UAMServer:"${profile.uam_server}",UAMAllowed:"${profile.uam_allowed}",UAMDomain:"${profile.uam_domain}",SSID:"${profile.ssid}"]`, {}, {path:1}); 

Thank you very much. It worked perfectly.