|
Home > Archive > Unix Shell > February 2005 > ksh and +() regex
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| michaelkatsilis@yahoo.com 2005-02-22, 5:53 pm |
| Hi,
How can I do the following using +() regex
ls +(dir1|dir2|dir2/subdir2)
The following works as expected
ls +(dir1|dir2)
but ksh does not like dir2/subdir2 inside the +().
The escaped version of the first example above doesn't work
ls +(dir1|dir2|dir2\/subdir2)
The preference is to use the +() syntax, so is there a way to make it
work?
Regards,
M
| |
| michaelkatsilis@yahoo.com 2005-02-28, 2:48 am |
| Right. That said, how about this: I want to run a script, I can only
access the directory names listed above (ie. in the sudo list), but I
don't know which directory contains the script (Please do not delve
into the PATH variable, as this is not what I'm after). So, what I'm
after is to find out if a one liner (not multiple lines, I've already
coded this) is possible, that runs the given script name in directories
dir1 or dir2 or dir2/subdir2
# ok, dir2/subdir2/f1 exists
>+(dir1|dir2)/*(subdir2)/f1
test file
# not ok, but dir1/f1 does exist - so why doesn't this work?
>+(dir1|dir2)/*(subdir1)/f1
ksh: +(dir1|dir2)/*(subdir1)/f1: not found.
# Now, this works (without slash), but it won't for file
+(dir1|dir2)/*(subdir1)f1
>+(dir1|dir2)/*(subdir2)fd1
test file in dir 1
Regards,
Michael
|
|
|
|
|