![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| How to navigate previous files one by one. | ajayshukla | UNIX for Dummies Questions & Answers | 5 | 08-14-2008 12:25 PM |
| Viewing Directory Content as You Navigate Directories in UNIX | shelata | UNIX for Dummies Questions & Answers | 2 | 07-28-2008 01:39 AM |
| How Do I Navigate To A Directory??? | kprescod4158 | Shell Programming and Scripting | 2 | 01-20-2008 05:24 AM |
| Can you navigate ABOVE the home directory? | patwa | UNIX for Dummies Questions & Answers | 4 | 06-13-2007 10:27 PM |
| need to acces unix box thrugh the internet | RuDe_BuT_CoOoL | UNIX for Dummies Questions & Answers | 4 | 05-10-2003 10:30 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi,
I have a requiremnet where i need to apply logic on directories and sub-direcotories. Example: base="/a/b/c" base1="/a/b/c/d/e" subfolders in both base and base1 are same : es, ig, os var1=es var2=ig var3=os Now i have used the follwoing lines in my code and these are creating problem for dir in "($base | $base1)/$var1" "($base | $base1)/$var2" "($base | $base1)/$var3" do ( echo "The current directory is:"`pwd` >> ${LogFile} cd "$dir" || continue for i in *.* do ( touch "$i" && printf 'Success: %s\n' "$i" || printf 'Failed: %s\n' "$i" >> ${LogFile} ) done ) done Please suggest on the above code . while executing for loop it is not working. |
|
||||
|
Thank you Christoph.
I have used it in script as below. But it did not work for me. Please suggest. for dir in "$base"/{"$var1","var2","$var3",d/e/{"$var1","var2","$var3"}/* touchfiles1.sh[37]: /a/b/c/{es,ig,os,/d/e/{es,ig,os}/*: not found. |
|
||||
|
There is a closing brace missing.
What my snippet does it iterates through all of your directories and will print out the files and directories in them. You should be able to adjust this to your needs. Perhaps you should describe in greater detail what you want to achieve. What is your input, what shall your output be. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|