#!/usr/local/bin/perl -w

print "Che versione di Athena vuoi? (tipo 11.0.5)\n";
$version=<STDIN>;
chomp($version);
print "Setup per versione $version\n";
$dirhome=`echo \$HOME`;
chomp($dirhome);
$setup1="source $dirhome/cmthome/setup.sh -tag=$version";
print "$setup1\n";
#system("$setup1");
$dir="/afs/cern.ch/atlas/software/dist/$version/Control/AthenaRunTime";
opendir(DIRCMT,"$dir") || die " Cannot open $dir: $!";
@dir2=readdir DIRCMT;
closedir(DIRCMT);
#print "$dir2[2]\n";
$setup2="source /afs/cern.ch/atlas/software/dist/$version/Control/AthenaRunTime/$dir2[2]/cmt/setup.sh";
print "$setup2\n";
$filename="setupathena".$version.".csh";
print "$filename\n";
open(CSHFILE,">$filename") || die "$!";
print CSHFILE "$setup1\n";
print CSHFILE "$setup2\n";
close(CSHFILE);
#system("$setup2");
#system("source setupathenaversion.csh");

