Introductory blog post: https://www.conjur.org/blog/stop-bashing-bash/
_______________ _______________
.' .' .|
.' .' .' |
.'_______________.'______________ .' |
| ___ _____ ___ || ___ _____ ___ | |
||_=_|__=__|_=_||||_=_|__=__|_=_|| |
______||_____===_____||||_____===_____|| | __________
.' ||_____===_____||||_____===_____|| .' .'|
.' ||_____===_____||||_____===_____|| .' .' |
.'___________|_______________||_______________|.'__________.' |
|.----------.|.-----___-----.||.-----___-----.|| |_____.----------.
|] |||_____________||||_____________||| .' [ |
|| ||.-----___-----.||.-----___-----.||.' | |
|| |||_____________||||_____________|||==========| |
|| ||.-----___-----.||.-----___-----.|| |_____| |
|] o|||_____________||||_____________||| .' [ 'o|
|| ||.-----___-----.||.-----___-----.||.' | |
|| ||| ||||_____________|||==========| |
|| ||| |||.-----___-----.|| |_____| |
|] ||| |||| ||| .' [ |
||__________|||_____________||||_____________|||.'________|__________|
''----------'''------------------------------'''----------''
(o)LGB (o)
The place to store functions that are used in pipelines for multiple repos.
Please add whatever is useful to you, but keep it tidy so its still useful to everyone else :)
TL;DR: Ready for use, but needs expansion.
The functions in this repo are tested and ready for use, but certain libsare pretty much place holders (eg logging). Those need further contributionsbefore they provide a comprehensive solution.
See the license file
Add bash-lib into your project in the way that best fits your workflow. The only requirement is that you pin the version ofbash-lib that you use. This is important so that changes to bash-lib do not have the power to break all projects that usebash-lib. Your project can then test updates to bash-lib and roll forward periodically.
Options:
Once you have bash-lib cloned in your project, you source two things:
bash-lib/init
. This ensures submodules are initalised and sets the BASH_LIB_DIR env var to the absolute path to the bash-lib dir. This makes it easy to source libraries from other scripts.${BASH_LIB_DIR}/lib-name/lib
for any libraries you are interested in.You are now ready to use bash-lib functions :)
The /init
script sets up everything required to use the library, mostimportantly the BASH_LIB_DIR
variable which gives the absolute path to the rootof the library and should be used for sourcing the modules.
The repo is organized into libraries, each library is a directory that has alib file. Sourcing the lib for a library should expose all the functionsthat library offers. The lib file may source or reference other supportingfiles within it's directory.
.
├── libname
│ ├── lib
│ └── supporting-file
├── init # init script, source this first
├── run-tests # top level test script, executes all tests
├── secrets.yml # secrets required for executing tests
├── test-utils
│ ├── bats # git subtree
│ ├── bats-assert-1 # git subtree
│ ├── bats-support # git subtree
│ ├── lib
│ └── tap2junit
└── tests-for-this-repo
├── filehandling.bats
├── fixtures #
│ └── libname # Dir containing test fixtures for a library
├── tap2junit
├── libname.bats # contains tests for libname/lib
├── python-lint # supporting files for python lint
├── run-bats-tests # script to run bats tests
├── run-gitleaks # script to check for leaked secrets
└── run-python-lint # script to run python lint
Library | Description | Functions |
---|---|---|
filehandling | Functions relating to file and path handling |
|
git | Git helpers |
|
github | Github Related Functions |
|
helpers | Bash scripting helpers |
|
k8s | Utils for connecting to K8s |
|
logging | Helpers related to logging. |
|
Ruby | Helpers related to ruby infrastructure |
|
test-utils | Helpers for executing tests |
|
For further information on contributing, style & testing, please see CONTRIBUTING.md
从root用户su -l oralce时不是正常的显示[oracle@soarServer ~],而是显示成-bash-4.1$,并且使用sqlplus / as sysdba报说没有该命令,最后发现oracle下的 .bash_profile文件被删除,重新建该文件: -bash-4.1$ vi .bash_profile TMP=/tmp; export TMP TMPDIR=$TMP; ex
切换到Mysql用户后显示:-bash-4.2$,不显示用户名路径 原因:因安装Mysql是用rpm包的方式安装,mysql用户是默认安装到了/var/lib/mysql目录 [root@mwm skel]# cat /etc/passwd |grep mysql mysql:x:987:982:MySQL server:/var/lib/mysql:/bin/bash 一般在linux下通过us
在编译alsa的时候报错,config完毕后,make错误如下: line 81: automake-1.16: command not found root@sw-desktop:/home/libalsa/src/alsa-lib-1.2.3.2/alsa-lib-1.2.3.2# make cd . && /bin/bash /home/libalsa/src/alsa-lib-1.2.3
1.每个用户都有的配置文件,只对单独的用户有效 .bash_profile:用户每次登录时执行 .bashrc:每次进入新的Bash环境时执行 .bash_logout:用户每次退出登录时执行 .bash_history 保存上次用户注销前使用的命令 [root@station6 tan]# ls -a . .bash_history .bash_profile er .mo
Su – oracle切换过去的时候,发现没有显示oracle@hostname标识,而是显示了-bash-4.1$ ,如下所示: [root@hch_test_pd_121_217 ~]# su - oracle
这几天在着手将项目部署到实际的云服务器上 本文针对的问题是配置云服务器环境的解决方法,仅供参考 针对以上问题,解决方法: 使用以下名令前提是:要以root权限执行,若你的身份不是root请看第2点 1.直接处理: 命令行输入:apt-get install libc6-i386 2.不是root在线 解释以下,租服务器并部署虚拟机,默认我们是有root账户的,但是没有设定密码,故进行如下操作 2.
以下切换ksh到bash在攀商行yypt(银银合作)平台测试: 1. #echo $SHELL /bin/ksh #which bash /usr/bin/bash #cd /usr/bin #bash // 执行后提示错误 不能切换到bash,错误提示貌似是找不到libintl.so.8,查看/opt/freeware/lib/下有libintl.a,而没有libintl.so.8 2. 下
【linux】-bash: /bin/ls: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory linux操作移动了根目录下的/lib和/lib64之后系统使用除了cd之外的任何命令都提示 -bash: /bin/ls: /lib64/ld-linux-x86-64.so.2: bad ELF
问题背景 误删系统软链,此时只能使用cd、pwd,其他所有shell命令都不能执行, ssh也不行。 注意:此时切勿退出终端!! 问题现象 bash: /usr/bin/ls: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory 问题解决 sln可能也是软链,所以有以下两种恢复方法 方法一 /usr
问题 [root@ecs-218164 src]# ls -bash: /usr/bin/ls: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory [root@ecs-218164 src]# clear -bash: /usr/bin/clear: /lib64/ld-linux-x86-64.
sudo rm -rf /usr/bin/python3 sudo ln -s /usr/bin/python3m /usr/bin/python3 (python3m 是cd到/usr/bin下ls python* 找的)
1、sudo apt-get install --reinstall python2.7-minimal 3.4 2.可能是一个破碎的系统链接sudo ln -s /usr/bin/python3.4 /usr/bin/python3或类似的位置找到你的python 3二进制文件并链接它。
好了,现在我们换了一个遥控器,感觉顺手多了。现在来操练一下,下载一首 mp3: 我们使用 wget 这个程序,它非常可靠,完全值得您信赖。 首先找到一个可以下载的地址,复制链接,在终端窗口内点击鼠标中键,把它粘贴进去。 现在终端中大概是这种情形: http://linuxtoy.org/xxx.mp3 按下 Ctrl+a 组合键,我们发现光标移动到了行首。输入 wget 和 空格 wget ht
语法 基本语法 名称 语法 描述 示例 interpreter #!/bin/bash Bash shell 脚本的第一行以 #! 开头,通常也称为 sharp-bang 或缩写版本 sha-bang。后面的路径名称是命令解释器,也就是应该用于执行脚本的程序。 echo echo "arbitrary text" echo "arbitrary text" >&2 文本定向到标准输出 (STDOU
bash 是一个为GNU项目编写的Unix shell。它的名字是一系列缩写:Bourne-Again SHell — 这是关于Bourne shell(sh)的一个双关语(Bourne again / born again)。Bourne shell是一个早期的重要shell,由Stephen Bourne在1978年前后编写,并同Version 7 Unix一起发布。bash则在1987年由B
Bash++ 是一个将 bash 提升到一个新水平的框架,为 bash 引入了新功能。它的设计是为了让人们能够建立更复杂的应用程序,创造更好的产品。 请注意,这个项目是为有 bash 经验的人准备的(不多,只是简单的理解和事情通常如何运作)。 运行示例 (确保你已经安装bash++) cd 进入示例目录。 对你想运行的脚本进行chmod。 chmod +x [SCRIPT.sh] 运行该脚本 ./[SCRIPT].sh
Bash-it 是一款针对bash使用进行优化的软件,提供了终端显示的主题优化、命令补全、命令别名、插件、版本控制目录状态实时显示等实用功能,能让bash更好用!正如软件readme说的那样,本款软件是模仿 http://www.oschina.net/p/oh-my-zsh 的,只不过是使用在bash环境中。 安装本软件需要有bash(这个大多数类Unix系统都具备)、git(如果下载zip包也
Bash-Snippets 这个项目完全是为重度终端用户而生的,里面包含了大量的 Bash 脚本,而且无需任何依赖。 示例: Crypt 封装了 openssl,可用于快速加密和解密文件 crypt -e [original file] [encrypted file] # encrypts filescrypt -d [encrypted file] [output file] # decryp
黑客对linux发展贡献是非常多的。Bash命令自动完成功能只不过是收集各种黑客指定参数是如何通过Readline使用内置完成来完成的。该功能在其他linux分支是启用的,如ubuntu、debian等等。然而,基于RHCE分支发布的linux版本却没有安装和启用,如CentOS。 如果你使用过ubuntu系统,bash命令自动补齐会觉得非常方便高效。再使用RHCE或CentOS的话,你肯定会吐槽
bash-handbook This document is written for those who want to learn Bash without diving in too deeply. Tip: Try learnyoubash — an interactive workshopper based on this handbook! Node Packaged Manuscrip