
shell
白菜1031
欢迎关注公号【全栈札记】
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
我的第一个shell脚本
#!/usr/bin/env bashlogPwd='/home/wangsai/log/update_stat_count.log'# 获取起始Id和结束Id res=`curl https://xxx.com/stat/api/get-user-ids` echo $res >> $logPwd reslen=${#res} echo $reslen >> $logPwd separateInd原创 2017-01-03 20:08:05 · 511 阅读 · 0 评论 -
【转】Linux重定向
I/O重定向详解及应用实例1. 基本概念(这是理解后面的知识的前提,请务必理解)a. I/O重定向通常与 FD 有关,shell 的 FD 通常为10个,即 0~9;b. 常用FD有3个,为0(stdin,标准输入)、1(stdout,标准输出)、2(stderr,标准错误输出),默认与keyboard、monitor、monitor有关;c. 用 < 来改变读进的数据信道(stdin),使之从指转载 2017-01-05 19:14:49 · 407 阅读 · 0 评论 -
Shell 显示所在项目当前git分支及状态
修改文件,添加如下vim .bashrcfunction git_branch { ref=$(git symbolic-ref HEAD 2> /dev/null) || return; echo "("${ref#refs/heads/}") "; }function parse_git_dirty { local git_status=$(git status 2> /原创 2017-07-10 16:28:39 · 2463 阅读 · 0 评论 -
shell常用命令小记
ls 正则匹配 # 列出文件名包含非字母,数字的文件 ls *[^0-9a-zA-Z]* # 列出以字母开头,文件名包含空格的.html文件 ls [a-zA-Z]*\ *.html 通过date命令获取昨天或明天时间 date命令可以获取当前的时间,通过man,可以看到date有很多参数可以用,很容易做到格式化 date +"%F" 输出格式:2011-12-31...原创 2017-03-31 12:10:47 · 359 阅读 · 0 评论