Tuna has asked for the wisdom of the Perl Monks concerning the following question:
What happens is that the script will not create the directory, change the permissions of the newly created script, nor try to even run it.#!/usr/local/bin/perl -w use strict; my $config = $ARGV[0]; my $date = $ARGV[1]; my $who = $ARGV[2]; my $program = "/nfs/elmo/users/dd/bin/gen-cflowd-config"; my $matrix = "netmatrix"; my $path = "/nfs/elmo/users/dd/config/$date"; my %hash; my $host; my $key; my $script = "script-$date"; die "Usage: $0 <file> <yyyymmdd> <user-name>\n" unless @ARGV == 3; open (CONFIG_FILE, $config) || die "Cannot open $config:$!\n"; while (my $line = <CONFIG_FILE>) { chomp $line; next if ($line =~ /^\#/); my ($router, $cache, $nta, $as, $Sample) = split (' ', $line); $host = (split "-", $nta)[0]; $host =~ tr/0-9//d; push @{$hash{$host}}, $router; } open (STDOUT, ">$script"); print <<END; #! /bin/sh if test ! -d /export/home/ss/flowstats/config/$date then mkdir /export/home/ss/flowstats/config/$date fi END print "\n\n"; foreach $key ( keys %hash) { print "$program $key $matrix "; print "$path/CISCO_$_.clean " for @{$hash{$key}}; print "\n\n"; } system "chmod 755 /export/home/ss/flowstats/config/$date/$script"; system "./export/home/ss/flowstats/config/$date/$script";
it creates the directory. What am I missing here?#! /bin/sh if test ! -d /export/home/ssesar/flowstats/config/$date then mkdir /export/home/ssesar/flowstats/config/$date fi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Script which creates 2nd script and runs it
by chipmunk (Parson) on Feb 01, 2001 at 01:36 UTC | |
by Tuna (Friar) on Feb 01, 2001 at 01:40 UTC | |
by Tuna (Friar) on Feb 01, 2001 at 01:45 UTC | |
by chipmunk (Parson) on Feb 01, 2001 at 01:55 UTC | |
|
Re: Script which creates 2nd script and runs it
by arturo (Vicar) on Feb 01, 2001 at 03:19 UTC | |
|
Re: Script which creates 2nd script and runs it
by isotope (Curate) on Feb 01, 2001 at 01:26 UTC | |
by Tuna (Friar) on Feb 01, 2001 at 01:34 UTC |