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

Hal Wigoda <[email protected]>
Newsgroups gmane.comp.lang.perl.beginners
Message-ID <[email protected]>
TOMTOWTDI


(Sent from iPhone, so please accept my apologies in advance for any spelling or grammatical errors.)

> On Jan 2, 2022, at 9:29 PM, hput via beginners <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
> 
> 

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.