File: ecaccess-command

package info (click to toggle)
ecaccess 6.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 360 kB
  • sloc: perl: 2,135; makefile: 8
file content (31 lines) | stat: -rwxr-xr-x 791 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl -w
#
# ecaccess: Helper to start any ecaccess command from the PAR archive
#
# Laurent.Gougeon@ecmwf.int - 2012-02-09

use ECMWF::ECaccess;
use Getopt::Long;
use Pod::Usage;
use IPC::System::Simple qw(system capture);

my $commandName = $ARGV[0];
my $dataDir     = $ENV{PAR_TEMP};

die "No command name specified!\n"    if not($commandName);
die "Not called from a PAR archive\n" if not($dataDir);

# Remove command name from args
shift(@ARGV);

# Define the filename of the script
my $command = "$dataDir\\inc\\script\\$commandName";

# Check if the command exists
die "Command $commandName not found!\n" if ( not( -e $command ) );

# Run the requested ecaccess command
eval { $exitCode = system( $^X, $command, @ARGV ); };

# Return exit code from command
exit($exitCode);