]> git.nbdom.net Git - nb.git/commitdiff
remove cron if no file or stdin
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 1 May 2023 19:24:03 +0000 (21:24 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 1 May 2023 19:24:03 +0000 (21:24 +0200)
bin/cron_d2crontab

index 9f826532550459dbc4a77dcfb3b0aff7df3b265b..ea1b7cce87d2625a7eb53949a13498df5de6b1f9 100755 (executable)
@@ -38,7 +38,12 @@ my $exp = shift @ARGV;
 #
 # Parse src file
 #
-my @src = map {chomp; $_} grep {/^(\w+=|\*|\d+|@)/} <>;
+#die @ARGV;
+#warn (-t ? 'YES' : 'NO');
+my @src = (@ARGV or !-t)
+       ? ( map {chomp; $_} grep {/^(\w+=|\*|\d+|@)/} <> )
+       : ()
+;
 
 for (my $i=0;$i<@src;$i++) {