my @files=`ssh $machine "ls $DIR/TEST[A-Z]*_[0-9].txt 2>/dev/null"`;
but gives me this error
ls: /home/devn/Test[A-Z]*_[0-9].txt: No such file or directory. Please advise
I dont have the net::ssh installed and i dont have the perms to install it.
Perl
Last Comment
oheil
8/22/2022 - Mon
oheil
Perhaps no file exists matching your patterns.
Try the same command without patterns and filter the result using perl:
my @files=`ssh $machine "ls $DIR/"`;
foreach my $file (@files){
if( $file =~ /TEST[A-Z]*_[0-9]\.txt/ ) {
push(@good_files,$file);
}
}
saibsk
ASKER
yes u were right there were no files. additionally how can i check whether the ssh with the command was successful whether it returned any files or not. Please advise
Try the same command without patterns and filter the result using perl:
my @files=`ssh $machine "ls $DIR/"`;
foreach my $file (@files){
if( $file =~ /TEST[A-Z]*_[0-9]\.txt/ ) {
push(@good_files,$file);
}
}