On 4/12/17 1:15 PM, Greg Silverman (CS) wrote:
>
> Many of the generated fixes uses this idiom
>
> IFS=$’\n’ …
>
> unset $IFS 
>
> IFS is a variable, but, $IFS is a character string, so, unsetting it
> does not restore IFS to its default value. What am I missing?
>

Those lines are from the audit remediation templates, e.g.:
https://github.com/OpenSCAP/scap-security-guide/blob/master/shared/xccdf/remediation_functions.xml#L97#L99

> IFS=$'\n' matches=($(sed -s -n -e "/${pattern}/!d" -e "/${arch}/!d" -e
> "/${group}/!d;F" /etc/audit/rules.d/*.rules))
> # Reset IFS back to default
> unset $IFS

Because the variable is used multiple times (e.g. each audit
remediation), it is a good practice to completely remove the
variable/data from the system between function calls.

For example:

$ stringVar="This is my string"
$ echo $stringVar
This is my string

$ unset stringVar

$ echo $stringVar
-bash: stringVar: unbound variable

_______________________________________________
Open-scap-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/open-scap-list

Reply via email to