regular expressions

Hi,

can anyone advise me how to shorten this:

if [ "$A" = "y" ] || [ "$A" = "Y" ] ; then

I tried [yY] but it dosent seem to work, whats the correct way.

Cheers

#!/bin/ksh
if [[ "$A" = [Yy] ]] ; then
   -- do stuff here
fi 

Thanks Jim!

Hi,

Sorry to bother you again, can I shorthand this also?

if ! [ -f "$@" ] && ! [ -d "$@" ]; then

again I tried this:

#if ! [ -f -d "$@" ]; then

but it didn't work, I have some code which works to about 90% as I need it but I want to reduce the code as much as possible.

Thanks again!

no -

-f checks if the file exists and is a regular file
-d checks if the file exists and is a directory

These are mutually exclusive, so you have to make both tests, and they need to be separate tests maybe like this

if [[  ! -f "$@"  && ! -d "$@"   ]] ; then 
-- do stuff
fi