summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/MDK/Common/System.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/MDK/Common/System.pm b/lib/MDK/Common/System.pm
index 7ff4e4c..1b24f21 100644
--- a/lib/MDK/Common/System.pm
+++ b/lib/MDK/Common/System.pm
@@ -338,12 +338,12 @@ sub getVarsFromSh {
open(my $F, $_[0]) or return;
local $_;
while (<$F>) {
- s/#.*//; # remove comments
+ s/^\s*#.*//; # remove comment-only lines
s/^\s*//; # leading space
my ($v, $val) = /^(\w+)=(.*)/ or next;
- if ($val =~ /^"(.*)"$/) {
+ if ($val =~ /^"(.*)"(\s+#.*)?$/) {
$val = $1;
- } elsif ($val =~ /^'(.*)'$/) {
+ } elsif ($val =~ /^'(.*)'(\s+#.*)?$/) {
$val = $1;
$val =~ s/(^|[^'])'\\''/$1'/g;
}