bash

All posts tagged bash

Lately been struggling with quotes and getting my variables working correctly inside the quotes.  With more precisely variables followed directly by text without spaces.  Like updating sudoers files the end result I want, to take whatever groups are in sudoers now and append _ldap to them using only bash echo.

%testgroup1 ALL=(ALL) ALL

%testgroup1_ldap ALL=(ALL) ALL

 

use strong quotes around everything except the variable

echo ‘%’$GROUP’_ldap ALL=(ALL) ALL’ >> /some/file