上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 24 下一页
摘要: 1. for in 语句 基本格式 for var in list do commands done 代码示例 list="test1 test2 test3" for value in $list do echo $value done 设置列表的分隔符 # 保存原始的分隔符设置 ifs=$IFS 阅读全文
posted @ 2022-03-23 18:34 箫笛 阅读(96) 评论(0) 推荐(0)
摘要: 1. 定义数组 array=(1 2 3 4) 2. 读取数组的值 array=(1 2 3 4) # 读取数组第一个元素 echo ${array[0]} # 1 # 读取素组的所有元素 echo ${array[*]} # 1 2 3 4 读取数组所有元素也可以用${array[@]}代替 3. 阅读全文
posted @ 2022-03-23 14:57 箫笛 阅读(73) 评论(0) 推荐(0)
摘要: 1. sed命令格式 sed options script file cat test.txt # 输出test.txt内容 this is test 1 this is test 2 this is test 3 sed 's/test/Test/' test.txt # 将test.txt中所有 阅读全文
posted @ 2022-03-21 13:04 箫笛 阅读(137) 评论(0) 推荐(0)
摘要: 1.字符串操作符实现 str="" str1="default" str2=${str:-$str1} echo $str2 # default 2. 条件测试实现 str="" str1="default" str2=$([ -z "$str" ] && echo "$str1" || echo 阅读全文
posted @ 2022-03-20 13:56 箫笛 阅读(507) 评论(0) 推荐(0)
摘要: 1. 获取字符串长度 str="test" echo ${#str} 2. 获取匹配的子串的长度 str="substring" echo $(expr match "$str" "*.b") 3. 获取子串的索引 str="substring" echo $(expr index "$str" " 阅读全文
posted @ 2022-03-20 12:11 箫笛 阅读(72) 评论(0) 推荐(0)
摘要: 1.声明字典 declare -A dic 2. 初始化字典 dic=( ["key1"]="value1" ["key2"]="value2" ["key3"]="value3" ) 3. 获取字典的值 value=${dic["key3"]} // 获取某个键的值 values=${dic[*] 阅读全文
posted @ 2022-03-20 09:57 箫笛 阅读(2984) 评论(0) 推荐(0)
摘要: 1. 在服务器端启用ssh服务 sudo /etc/init.d/ssh start 在服务端启用ssh服务 sudo update-rc.d ssh enable 将ssh服务设为开机自启动 2. 配置服务器ip为静态ip sudo vim /etc/dhcpcd.conf interface w 阅读全文
posted @ 2022-03-05 12:21 箫笛 阅读(224) 评论(0) 推荐(0)
摘要: 1. 格式化sd卡 利用macOS自带的磁盘工具格式化sd卡 访达-前往-实用工具-磁盘工具 点击sd卡对应的磁盘,并点击抹掉,格式选择MS-DOS(FAT) 2. 烧录镜像 利用df -h 查看sd卡挂载的卷,比如/dev/disk4s2 卸载sd卡挂载的分区,diskutil unmount / 阅读全文
posted @ 2022-02-25 18:38 箫笛 阅读(841) 评论(0) 推荐(0)
摘要: 使用abbreviations可以进行单词的拼写纠错,但用它进行代码的替换可以极大的提高编程效率 在.vimrc配置文件中自定义abbreviations 1. 纠正拼写错误 iabbrev adn and 输入adn时则自动纠正为and 2. 插入代码片段 iabbrev _fn () => {< 阅读全文
posted @ 2022-02-21 16:04 箫笛 阅读(110) 评论(0) 推荐(0)
摘要: Express可以使用jade, ejs作为模版引擎进行模版渲染,默认是jade,使用ejs作为模版引擎需要进行设置 1. 使用ejs模版 安装ejs模块 npm install ejs --save 设置ejs模版 // 设置模版文件目录 app.set('views', './templates 阅读全文
posted @ 2022-02-21 16:01 箫笛 阅读(201) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 24 下一页