develooper Front page | perl.beginners | Postings from January 2022

Re: Is this bit of scrip a reasonable way to test something

Thread Previous | Thread Next
From:
Vlado Keselj
Date:
January 3, 2022 05:43
Subject:
Re: Is this bit of scrip a reasonable way to test something
Message ID:
alpine.LFD.2.20.2201030143270.22032@tr

It looks good to me.

On Sun, 2 Jan 2022, hput via beginners wrote:

> I was just coding in in ksh93 for simple script but tangled up with
> way matching and regex work in ksh93.
> 
> Finally trashed it turned to perl.
> 
> Just have familiarity with one way of test in shell script:
> 
> Put it in an if clause like (in shell):
> 
> 
>   if [ cd somedir ];then
>     print "ok permissions were good to enter somedir"
>   fi
> 
> -------       -------       ---=---       -------       ------- 
> Wanting to see if an encrypted dir is open
> -------       -------       ---=---       -------       ------- 
> 
>   #!/usr/local/bin/perl
> 
>   use strict;
>   use warnings;
> 
>   my $loc = './s';
> 
>   print "Testing with `chdir', if my perms are good to enter $loc\n";
> 
>   if (chdir $loc) {
>     print "my perms  worked to enter <$loc>\n";
>   }
> 
> Is this a reasonable way to do this or am I missing some thing that
> will be quicker and more `perl' like?
> 
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
> 
> 

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About