持续更新中……
序列生成及数字填充
1 | $ for i in $(seq -f "%03g" 1 5);do echo $i;done |
拷贝文件时忽略指定的目录
1 | rsync -av --progress sourcefolder /destinationfolder --exclude="thefoldertoexclude" |
说明:thefoldertoexclude 是相对于 sourcefolder 目录的。也就是说忽略 sourcefolder 目录中的 thefoldertoexclude 目录
将当前目录下的所有文件的文件名变成小写字母
1 | $ for i in `find .`;do mv $i `echo $i |tr [A-Z] [a-z]`;done |
后台运行程序,将结果输出到 /dev/null 中,并将标准出错重定向到标准输出
1 | nohup java -jar you-java.jar > /dev/null 2>&1 & |
克隆网站到本地目录,可实现本地访问
https://askubuntu.com/a/512897
1 | wget --mirror -p --convert-links -P ./LOCAL-DIR WEBSITE-URL |
Options:
–mirror turns on options suitable for mirroring.
-p downloads all files that are necessary to properly display a given HTML page.
–convert-links after the download, convert the links in document for local viewing.
-P ./LOCAL-DIR saves all the files and directories to the specified directory.
获取 Shell 脚本的第一个参数和最后一个参数
1 |
|
测试结果如下:
1 | $ ./test.sh a b c d e f |