How to go to each directory and execute a command?

后端 未结 10 1039
無奈伤痛
無奈伤痛 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

    for p in [0-9][0-9][0-9];do
        (
            cd $p
            for f in [0-9][0-9][0-9][0-9]*.txt;do
                ls $f; # Your operands
            done
        )
    done
    

提交回复
热议问题