![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Regular expression | svenkatareddy | Shell Programming and Scripting | 4 | 08-17-2009 01:08 PM |
| Regular Expression Help | sickboy | Shell Programming and Scripting | 8 | 04-04-2009 06:58 PM |
| regular expression | jaber87 | Shell Programming and Scripting | 3 | 06-05-2008 04:07 AM |
| What does the regular expression ['(^[^~]+~).*'] mean? | anupamar | High Level Programming | 2 | 10-29-2007 04:41 AM |
| Regular Expression + Aritmetical Expression | Z0mby | Shell Programming and Scripting | 2 | 05-21-2002 11:59 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
regular expression go into a folder
Hi Everyone,
I have two folders /root/jul/a.txt and /root/july/a.txt. I have $month="jul", so use this methold, i only can go into the first folder. is there any way, i can do like $month="jul*", means can go to both folders? becuase the month folder, sometimes is jul, or july, or nov, november, or nove, or even NOVE, NOV. How to handle this case. ![]() Thanks |
|
||||
|
You can't go to "two folders", because you can only be at one place at a time - thats true for physics as well as Unix. ;-)) What you can do is to go to one folder after the other. Here is an example script: Code:
#!/bin/ksh
month="jul"
dir=""
ls -ld "/root/${month}*" | while read dir ; do
cd "$dir"
print - "now in directory: $PWD"
ls -l
print - "---------------"
cd -
done
I hope this helps. bakunin |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|