鸟哥私房菜1-第11章:认识Bash Shell
read
declare/typeset
array
ulimit
user limit
echo ${vbird##/*/}
删除所有//之间数据
echo ${vbird#/*/}
删除第一个//之间数据
echo ${vbird%%/*/}
从后面删除所有//之间数据
这样匹配,需要最后一个字符是/
echo ${vbird%%/*}
从后面删除所有/*之间数据
echo ${vbird%/*}
从后面删除第一个有/*之间数据
echo ${vbird/testing/TEST}
用TEST替换testing(仅仅第一个)
echo ${vbird//testing/TEST}
用TEST替换testing(所有)
类似的操作符有
-/:-/+/:+/=/:=/?/:?
规则感觉比较奇怪
alias / unalias
history
~/.bash_history
!number 执行第几条命令
!command 最近命令往前搜索“命令行开头是command”的命令,并执行
!! 执行上一个命令
登陆消息显示数据:
/etc/issue,/etc/motd
环境设置文件:
bashrc, ~/.bashrc, ~./profile, profile..., /etc/inputtrc, source
/etc/sysconfg/i18n
/etc/profile
/etc/bashrc
/etc/profile.d/*sh
/etc/man.config
~/.bash_profile, ~/.bash_login, ~/.profile
~/.bashrc
~/.bash_history
~/.bash_logout
登陆文件的读取
/etc/profile -> /etc/profile.d, /etc/inputtrc -> ~/.bash_profile,
~/.bash_login, ~/.profile -> ~/.bashrc
登陆shell,读取
~/.bash_profile, ~/.bash_login, ~/.profile
非登陆shell,仅仅读取
~/.bashrc
stty, set
stty erase ^C
Ctrl + D 输入结束
Ctrl + S 暂停屏幕输出
Ctrl + Q 回复屏幕输出
Ctrl + Z 暂停当前命令
Ctrl + C 终止当前命令
数据流重导向
标准输入,代码0,<, <<
标准输出,代码1, >, >>
标准错误输出,代码2,2>, 2>>
/dev/null
错误 find /home -name testing > list.txt 2> list.txt
正确 find /home -name testing > list.txt 2> &1
cat > cat_output.txt < cat_input.txt
cat > cat_output.txt << eof
命令执行的判断根据: ;, &&, ||
sync; sync; shutdown -h now
ls /tmp && touch /tmp/testingagain
ls /tmp/vbird || touch /tmp/vbird
管道命令
管道命令"|"只能处理通过前面一个命令传来的正确信息,也就是标准输出信息,对标准错
误,并没有直接处理的能力
选取命令 cut, grep
排序命令 sort, wc, uniq
wc 计算文件内容的工具
双向重导向 tee
能同时输出到2个地方,可以能既输出到屏幕,又输出到文件
默认情况下,如果输出到文件,就不能输出到屏幕了
字符转换命令 tr, col, join, paste, expand
tr 删除一段消息中的文字,或者进行文字替换
last | tr '[a-z]' '[A-Z]' 将所有小写字母转成大写字母
col 将tab键转换成对等的空格键
join 处理2个文件时,有相同数据行,将他们加在一起
分享到:
相关推荐
第11章 认识与学习bash 第12章 正则表达式与文件格式化处理 第13章 学习shell script 第四部分 Linux使用者管理 第14章 Linux账号管理与ACL权限设置 第15章 磁盘配额(Quota)与高级文件系统管理 第16章 例行性...
介绍的bash等。广义的壳程序则包括图形接口的软件!因为图形接口其实也能够操作各种应用程序来呼叫核心工作啊!不过在本章中,我们主要还是在使用 bash 啦!为何
简单的Bash脚本到Windows批处理文件转换器将bash脚本( *.sh )转换为Windows批处理文件( *.bat )。 这不应该是一个完全完整/正确的工具,而是转换脚本时的起点。 对于简单的脚本,这可能会创建正确的结果。 在线...
学习bash-shell-script 学习BASH Shell脚本
我们一定会写一个shell脚本去每一个节点上去jps,查看每个节点的进程情况。 原先以为shell很简单: #!/bin/bash #查看每个节点运行情况 for((host=101;host<108;host++));do echo -----------hadoop$host--------...
docker build --rm -t thelebster/mongo-shell-example .docker run -ti --rm --name mongo-shell-example -d thelebster/mongo-shell-exampledocker exec -it mongo-shell-example bashdocker run -ti --rm --name...
bash-powerline-shell:为您的bash shell提供美观,有效和有用的PS1提示
对于学习bash shell用法和编写简单脚本很有用。 有用的提示:shellcheck扩展在调试之前发现常见的脚本错误非常有用。 用法 选择“调试”->“添加配置”以添加自定义调试配置(下拉菜单,路径输入等)。 选择Debug...
gitlab-bash-api:使用bash脚本配置GitLab
vboxmanage-bash-completion:VBoxManage bash完成
bash-oo-framework:Bash Infinity是bash的现代样板框架标准库
linux-shell-scripting-fundamentals-bash.epub
yeelight-shell-scripts:使用bash脚本控制Xiaomi Mi Yeelight(RGB)
《学习 bash 第二版(英文版)》.chm,作者:Cameron Newbam & Bill Rosenblatt。...第十一章:用户系统 bash。 附录一:相关 shell。 附录二:参考列表。 附录三:可载入命令。 附录四:语法。 附录五:获得示例程序。
教程名称:老段带你学鸟哥Linux(第三版)视频教程课程目录:【】第10章:vim程序编辑器【】第11章:认识与学习bash【】第12章:正则表达式与文件格式化处理【】第13章:学习shell script【】第14章:Linux...
gnome-shell-extension-installer:一个bash脚本,用于从extensions.gnome.org搜索和安装扩展
Linux运维-3.Shell编程-11shell基础-103Bash基本功能2.avi
命令行界面简介(shell / bash / Unix / Linux) 观众所需的计算能力期间生物学家没有任何1天的研讨会(约6个小时,由讲师指导)描述该存储库包含为期1天的Shell入门课程的教学材料。 本次研讨会的重点是教学的基本...
Linux运维-3.Shell编程-11shell基础-102Bash基本功能1.avi
等待它wait-for-it.sh是一个纯bash脚本,它将等待主机和TCP端口的可用性。 对于同步相互依赖的服务(例如链接的Docker容器)的启动很有用。 由于它是纯bash脚本,因此它没有任何外部依赖性。用法wait-for-it.sh host...