ICode9

精准搜索请尝试: 精确搜索
  • shell 解压当前目录所有zip文件2021-01-30 17:03:04

    code macname@MacdeMacBook-Pro zipfiles % cat test.sh #!/bin/bash ZIP_FILES=$(ls *.zip) for zip_file in $ZIP_FILES; do unzip $zip_file done macname@MacdeMacBook-Pro zipfiles %                

  • python3 并发编程2020-12-01 22:33:47

    多进程 macname@MacdeMacBook-Pro Desktop % macname@MacdeMacBook-Pro Desktop % macname@MacdeMacBook-Pro Desktop % python3 test.py main test 0 test 0 test 1 test 1 test 2 test 2 test 3 test 3 test 4 test 4 test 5 test 5 test 6 test 6 test 7 test 7 test 8 tes

  • sed 字符串替换2020-12-01 14:02:58

    content macname@localhost Desktop % macname@localhost Desktop % cat ddd This is a test of the test script. This is the second test of the test script. macname@localhost Desktop %   #在行中替换文本 macname@localhost Desktop % sed 's/test/trial/' ddd

  • shell 获取数组的长度2020-11-25 21:02:35

    code macname@localhost Desktop % cat test.sh my_array[0]=A my_array[1]=B my_array[2]=C my_array[3]=D echo "数组元素个数为: ${#my_array[*]}" echo "数组元素个数为: ${#my_array[@]}"%

  • shell sed 打印输出指定行的内容2020-11-25 21:00:31

    code macname@localhost Desktop % cat a.txt 1dededede 2dedefrfr 3frhvfvfvf 4frfrdede 5frfrfrfrf 6frfrede 7jukitttt 8csxssss 9zaxss 10swwww 11ssssss 12aaaaa macname@localhost Desktop % macname@localhost Desktop % macname@localhost Desktop %

  • shell 获取字符串的长度2019-08-23 23:53:32

      awk 方式 bogon:conf macname$ echo "abcde" | awk '{print length($0)}'5   利用${#str}来获取字符串的长度 bogon:conf macname$ a="abcdef"bogon:conf macname$ echo ${#a}6   wc 方式(注意是包含换行符的) bogon:conf macname$ echo "abcde" | wc

  • python 获取文件本身的绝对路径2019-08-22 16:50:50

      tester.py: import osprint (os.path.dirname(__file__))print (os.path.abspath(__file__))print (os.path.abspath(os.path.dirname(__file__)))print (os.path.dirname(os.path.abspath(__file__))) 输出 bogon:Desktop macname$ python3 tester.py /Users/macname/Desk

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有