2

Bash

 2 years ago
source link: https://linuxsuren.github.io/blog/os/linux/common/bash/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

替换 echo "ab/c/df" | sed 's/\//-/g'

变量 说明 示例 $# 参数个数

$0 当前脚本文件名

$1 第一个参数,后面的参数则依次类推,例如:第二个参数为$2

$_ 上一条名称的最后一个参数 mkdir temp

命令自动补全

我们可以使用 brew 来安装 bash 的自动补全:brew install bash-completion

我们可以把特定命令的自动补全脚本保存到这个目录中 /usr/local/etc/bash_completion.d

for i in {1..5}
do
  echo $i
done

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK