【问题标题】:Bash - search directory for all scriptsBash - 搜索所有脚本的目录
【发布时间】:2014-04-06 17:05:13
【问题描述】:

我需要在一个目录(和所有子目录)中搜索所有脚本,并使用完整路径和脚本类型将它们写出来。输出应如下所示:

/home/student/scripts/find.sh bash
/home/student/scripts/bin/server.pl perl
/home/student/scripts/bin/client.pl perl

我知道我应该使用find,然后head和grep来确定脚本的类型,但是我真的不擅长bash,你能帮帮我吗?

【问题讨论】:

    标签: linux bash scripting


    【解决方案1】:

    这会让你接近你想要得到的东西:

    find /home/student/scripts -type f -name "*.*" -exec file '{}' +
    

    【讨论】:

    • 谢谢,但是这段代码没有做我需要的,它没有写出任何东西。
    猜你喜欢
    • 2010-12-27
    • 2018-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-29
    • 2016-06-27
    相关资源
    最近更新 更多