@@ -900,6 +900,7 @@ static int _write_script_header_to_fd(struct xccdf_policy *policy, struct xccdf_
900
900
const char * oscap_version = oscap_get_version ();
901
901
const char * format = ansible_script ? "ansible" : "bash" ;
902
902
const char * remediation_type = ansible_script ? "Ansible Playbook" : "Bash Remediation Script" ;
903
+ const char * shebang_with_newline = ansible_script ? "" : "#!/bin/bash\n" ;
903
904
904
905
char * fix_header ;
905
906
@@ -934,6 +935,7 @@ static int _write_script_header_to_fd(struct xccdf_policy *policy, struct xccdf_
934
935
const char * xccdf_version_name = xccdf_version_info_get_version (xccdf_version );
935
936
936
937
fix_header = oscap_sprintf (
938
+ "%s"
937
939
"###############################################################################\n"
938
940
"#\n"
939
941
"# %s for %s\n"
@@ -956,7 +958,7 @@ static int _write_script_header_to_fd(struct xccdf_policy *policy, struct xccdf_
956
958
"%s\n"
957
959
"#\n"
958
960
"###############################################################################\n\n" ,
959
- remediation_type , profile_title ,
961
+ shebang_with_newline , remediation_type , profile_title ,
960
962
commented_profile_description ,
961
963
profile_id , benchmark_id , benchmark_version_info , xccdf_version_name ,
962
964
oscap_version , profile_id , format , remediation_type ,
@@ -974,6 +976,7 @@ static int _write_script_header_to_fd(struct xccdf_policy *policy, struct xccdf_
974
976
const char * xccdf_version_name = xccdf_version_info_get_version (xccdf_version );
975
977
976
978
fix_header = oscap_sprintf (
979
+ "%s"
977
980
"###############################################################################\n"
978
981
"#\n"
979
982
"# %s generated from evaluation of %s\n"
@@ -992,7 +995,7 @@ static int _write_script_header_to_fd(struct xccdf_policy *policy, struct xccdf_
992
995
"%s\n"
993
996
"#\n"
994
997
"###############################################################################\n\n" ,
995
- remediation_type , profile_title , profile_id , xccdf_version_name ,
998
+ shebang_with_newline , remediation_type , profile_title , profile_id , xccdf_version_name ,
996
999
start_time != NULL ? start_time : "Unknown" , end_time , oscap_version ,
997
1000
result_id , format , remediation_type , remediation_type , how_to_apply
998
1001
);
0 commit comments