How to go to each directory and execute a command?

后端 未结 10 1023
無奈伤痛
無奈伤痛 2020-12-02 04:13

How do I write a bash script that goes through each directory inside a parent_directory and executes a command in each directory

10条回答
  •  隐瞒了意图╮
    2020-12-02 04:25

    I don't get the point with the formating of the file, since you only want to iterate through folders... Are you looking for something like this?

    cd parent
    find . -type d | while read d; do
       ls $d/
    done
    

提交回复
热议问题