zoukankan      html  css  js  c++  java
  • Linux命令之{ }花括号

    括号扩展:{ }

    {} 可以实现打印重复字符串的简化形式

    [10:04:14 root@C8[ 2020-06-16DIR]#echo file{1,3,5}
    file1 file3 file5
    [10:11:58 root@C8[ 2020-06-16DIR]#echo {1..35}
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
    [10:12:22 root@C8[ 2020-06-16DIR]#echo {a..z}
    a b c d e f g h i j k l m n o p q r s t u v w x y z
    [10:12:34 root@C8[ 2020-06-16DIR]#echo {a..Z}  #ASSCII码
    a ` _ ^ ]  [ Z
    [10:12:40 root@C8[ 2020-06-16DIR]#echo {A..z}
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [  ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z
    [10:12:56 root@C8[ 2020-06-16DIR]#echo {1..36..2}
    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35
    [10:13:35 root@C8[ 2020-06-16DIR]#echo {1..36..3}
    1 4 7 10 13 16 19 22 25 28 31 34
    [10:13:45 root@C8[ 2020-06-16DIR]#echo {1..36..4}
    1 5 9 13 17 21 25 29 33
    [10:13:49 root@C8[ 2020-06-16DIR]#echo {1..36..5}
    1 6 11 16 21 26 31 36
    [10:13:52 root@C8[ 2020-06-16DIR]#echo {1..36..6}
    1 7 13 19 25 31
    [10:13:55 root@C8[ 2020-06-16DIR]#echo {1..36..7}
    1 8 15 22 29 36
    [10:13:58 root@C8[ 2020-06-16DIR]#echo {1..36..10}
    1 11 21 31
    

    可以组合使用

    笛卡尔乘积 完全组合

    [10:14:03 root@C8[ 2020-06-16DIR]#echo file{1..10}.{txt,log}
    file1.txt file1.log file2.txt file2.log file3.txt file3.log file4.txt file4.log file5.txt file5.log file6.txt file6.log file7.txt file7.log file8.txt file8.log file9.txt file9.log file10.txt file10.log
    [10:21:26 root@C8[ 2020-06-16DIR]#echo {20200601..20200616}.log #生成20200601到20200616的日志文件
    20200601.log 20200602.log 20200603.log 20200604.log 20200605.log 20200606.log 20200607.log 20200608.log 20200609.log 20200610.log 20200611.log 20200612.log 20200613.log 20200614.log 20200615.log 20200616.log
    
    * * * 胖并快乐着的死肥宅 * * *
  • 相关阅读:
    方法
    属性
    Cocoapods完整使用篇
    这样好用的ReactiveCocoa,根本停不下来【转载】
    OS开发之旅之App的生命周期【转载】
    ios 推送证书没有密钥 解决方案【转载】
    移动应用开发测试工具Bugtags集成和使用教程【转载】
    MagicalRecord使用教程【转载】
    GIT客户端的使用【原创】
    iOS开发系列--让你的应用“动”起来【转载】
  • 原文地址:https://www.cnblogs.com/bpzblog/p/13139574.html
Copyright © 2011-2022 走看看