持续更新中......
序列生成及数字填充
$ for i in $(seq -f "%03g" 1 5);do echo $i;done
001
002
003
004
005
拷贝文件时忽略指定的目录
rsync -av --progress sourcefolder /destinationfolder --exclude="thefoldertoexclude"
说明:thefoldertoexclude 是相对于 sourcefolder 目录的。也就是说忽略 sourcefolder 目录中的 thefoldertoexclude 目录
将当前目录下的所有文件的文件名变成小写字母
$ for i in `find .`;do mv $i `echo $i |tr [A-Z] [a-z]`;done
后台运行程序,将结果输出到 /dev/null 中,并将标准出错重定向到标准输出
nohup java -jar you-java.jar > /dev/null 2>&1 &
克隆网站到本地目录,可实现本地访问
https://askubuntu.com/a/512897
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 脚本的第一个参数和最后一个参数
#!/bin/bash
numArgs="$#"
echo "Number of args: $numArgs"
firstArg="$1"
echo "First arg: $firstArg"
lastArg="${!#}"
echo "Last arg: $lastArg"
allArgs="$@"
echo "All arguments: $allArgs"
allArgsExeptLastOne="${@:1:$(($#-1))}"
echo "All arguments except last one: $allArgsExeptLastOne"
测试结果如下:
$ ./test.sh a b c d e f
Number of args: 6
First arg: a
Last arg: f
All arguments: a b c d e f
All arguments except last one: a b c d e
分享到:
相关推荐
Linux Shell常用技巧Linux Shell常用技巧
linux,shell的常用命令,课件很不错总结很详细
Linux Shell常用技巧-带完整书签目录超清文字版.pdf 这个是带完整目录书签的文字版本,文本内容可以复制的哦
所有linux命令的源代码 cat cp date df dd ls .....
linux shell脚本攻略源代码.对学习shell脚本有很大的帮助。
运维常用的 34 个 Linux Shell 脚本.doc
2,此源代码不完整,shell的很多功能都没有实现,只是实现了一些主要的功能 3,实现功能如下: a,输入命令,并运行 b,实现if 和while的深层嵌套 c,实现环境变量,和shell本身变量 d,实现管道和重定向...
一些人仍然会有这种想法,他们认为使用Linux就必须使用Linux shell命令。胡说!你可以不懂得任何Linux命令,比如说ps,grep,ls等,但是你仍然可以使用很多现代的Linux桌面发行版。 Linux的系统管理员与桌面用户不...
Linux shell 及常用命令介绍.txt 1、更改帐号密码 语法:passwd Old password: <输入旧密码> New password: <输入新密码〉 Retype new password: <再输入一次密码> 2、联机帮助 语法: man 命令 例如: man ls 3、...
Linuxshell大作业.pdf
linux shell编程指南linux shell编程指南linux shell编程指南linux shell编程指南linux shell编程指南linux shell编程指南linux shell编程指南linux shell编程指南linux shell编程指南linux shell编程指南linux ...
LINUX SHELL命令练习 题
学习shell脚本经典书籍《Linux shell 脚本攻略-第二版》全书源代码合集
linux shell学习资料:Linux Shell从入门到精通、Linux Shell编程艺术、Linux Shell脚本攻略
Linux Shell Scripting Cookbook(3rd) 英文mobi 第3版 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
shell常用规则 shell特殊字符的引用 系统环境变量 循环语句 多重条件语句 命令组合:圆括号和花括号
Linux Shell脚本手册 - 第三版,. This book will take you through useful real-world recipes designed to make your daily life easier when working with the shell.
LinuxShell脚本编程实例.pdf
这些案例实用性很强,许多代码可以直接应用到Linux系统管理中。 本书配有全程录像的视频讲解光盘,读者可以将视频和书结合起来学习,可以更快、更好地掌握Linux Shell编程技术。 本书适合于Linux Shell编程的...