sanitize -N
authorDon Armstrong <don@donarmstrong.com>
Fri, 8 Jul 2016 20:00:27 +0000 (13:00 -0700)
committerDon Armstrong <don@donarmstrong.com>
Fri, 8 Jul 2016 20:00:27 +0000 (13:00 -0700)
dqsub

diff --git a/dqsub b/dqsub
index b1d1d05..eba7373 100755 (executable)
--- a/dqsub
+++ b/dqsub
@@ -150,7 +150,10 @@ if ($options{interactive} and @ARGV) {
 }
 
 # pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
-print STDERR join("\n",@USAGE_ERRORS) and exit 1 if @USAGE_ERRORS;
+if (@USAGE_ERRORS) {
+    print STDERR map {"$_\n"} @USAGE_ERRORS;
+    exit 1;
+}
 
 # OK. Generate the options to qsub which we'll be using
 my @qsub_options = generate_qsub_options(\%options,\@ARGV);
@@ -216,7 +219,9 @@ sub generate_qsub_options{
     if ($options->{name}) {
         push @qo,'-N',$options->{name};
     } else {
-        push @qo,'-N',join('_',@{$args}[0..min($#{$args},2)]);
+        push @qo,'-N',join('_',
+                           map {s/[^a-zA-Z0-9]*//g; $_;}
+                          @{$args}[0..min($#{$args},2)]);
     }
     # join error and output streams
     if ($options->{join}) {