Help...
I've got a script which I'm passing several arguements to, or maybe none depending on the situation.
I use the join command to smack them into one variable and am working with that.
-snip-
if ($usern =~ m/-[vV]/) { # verbose
$usern =~ s/\s*(\-[vV])\s*//;
$v = 1;}
if ($usern =~ m/-[dD]/) { # duplicates
$usern =~ s/\s*(\-[dD])\s*//;
$d = 1;}
if ($usern =~ m/-[fF]/) { # filename
$usern =~ s/\s*(\-[fF])\s*//;}
-unsnip-
This last one is where I'm stuck. What I was doing before was assuming that the remaining data in the string was the filename. What I would rather do is grab everything from after the -f excluding the first space to the end or next space whichever it finds first.
There may well be a better way to do all of this, but this is what I came up with so far =)
Thanks
I've got a script which I'm passing several arguements to, or maybe none depending on the situation.
I use the join command to smack them into one variable and am working with that.
-snip-
if ($usern =~ m/-[vV]/) { # verbose
$usern =~ s/\s*(\-[vV])\s*//;
$v = 1;}
if ($usern =~ m/-[dD]/) { # duplicates
$usern =~ s/\s*(\-[dD])\s*//;
$d = 1;}
if ($usern =~ m/-[fF]/) { # filename
$usern =~ s/\s*(\-[fF])\s*//;}
-unsnip-
This last one is where I'm stuck. What I was doing before was assuming that the remaining data in the string was the filename. What I would rather do is grab everything from after the -f excluding the first space to the end or next space whichever it finds first.
There may well be a better way to do all of this, but this is what I came up with so far =)
Thanks