think tank forum

technology » shell script heads

lucas's avatar
16 years ago
link
lucas
i ❤ demo
i have a bunch of directories, and i want to create a small file in each one.

here's what i have so far:
#!/bin/sh
for dir in "`ls -d *`" ; do
    (cd "$dir" ; touch bit)
done


for some reason, it doesn't work. it just spits the directory listing out. i'd love your help!
lucas's avatar
16 years ago
link
lucas
i ❤ demo
zsh!
euterpe% for i (*) touch $i/bit


:D
DaGr8Gatzby's avatar
16 years ago
link
DaGr8Gatzby
Drunk by Myself
Shit man ZSH rocks. I recently did something like this where my script created a directory for every day of the month:

 for (( i=1; i<30; i++ )); do mkdir 9-$i-2008; done