I have been provided a %post script inside a spec file to edit a config file (called foo). I have ben tasked with writing another, almost identical script to edit a file called 'bar'. While my solution for 'bar' technically works, it is dramatically different semantically. The custodian is requesting I rewrite it for consistency. foo.groovy before messageQueue.secretKey = <ENTER-KEY-HERE> foo.groovy after messageQueue.secretKey = y775hUYKR1Bm4gUWNRbzqg65The script given me is the following:%define oauth_client_Secret \echo   Setting the message queue secret key... \MESSAGEQUEUESECRETKEY=`dd if=/dev/urandom count=16 bs=1 2>/dev/null | base64` \for config_file in `find /opt/foo/etc -name *.groovy` \do \sed -i -e /messageQueue.secretKey/ {  \\\        -e     s?^//\s*?? \\\        -e     s?<ENTER-KEY-HERE>?${MESSAGEQUEUESECRETKEY}? \\\        -e } \\\    ${config_file} \doneWhat I am trying to figure out:What does this regex do? s?^//\s*?? I assume it is looking for an equals sign?What is the purpose of the trailing slashes ? \\\Why did the previous author surround the expression in brackets { } ?For reference, here is my script (for bar), that I am trying to rewrite to match the above script (for foo)bar.groovy beforeclientSecret:<ENTER-CLIENTSECRET-HERE>,bar.groovy afterclientSecret:4gUWNRbzqg65y775hUYKR1Bm,bar script%define oauth_client_Secret \echo   Generating oauth clientSecret... \MESSAGEQUEUESECRETKEY=`dd if=/dev/urandom count=16 bs=1 2>/dev/null | base64` \for config_file in `find /opt/bar/etc -name *.groovy` \do \sed -i s/<ENTER-CLIENTSECRET-HERE>/${MESSAGEQUEUESECRETKEY}/g ${config_file} \done
What does this regular expression do?
scripting;rpm