experts
I want to create file in each folder . Here is my command
for i in `ls`;do cd $i;touch test.txt;done
-bash: cd: 10/: No such file or directory
-bash: cd: 2/: No such file or directory
-bash: cd: 3/: No such file or directory
-bash: cd: 4/: No such file or directory
-bash: cd: 5/: No such file or directory
-bash: cd: 6/: No such file or directory
-bash: cd: 7/: No such file or directory
-bash: cd: 8/: No such file or directory
-bash: cd: 9/: No such file or directory
It only generate test.txt in folder 1/, the rest folder are blank. I think the reason is my command lack of { } to clarify the scale of LOOP for .
could you please help me update my command?
( )instead of{ }to achieve it .for i in */;do (cd $i;ls;cd -);done