bashrc和bash_profile

时间:2023-02-01 20:29:16

在~/.bashrc中起别名

!/bin/bash下必须加上shopt -s expand_aliases
#!/bin/sh下不用
shopt -s expand_aliases
这一条命令让shell脚本中的alias可以使用。但是经测试,在#!/bin/sh下,该命令可有可无,不影响alias的使用,在!/bin/bash下,才有影响。

~/.bash_profile中也不用

#go
export GOPATH="/Users/didi/go"
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN #mysql
export PATH=${PATH}:/usr/local/mysql/bin
export PATH="/usr/local/opt/php@7.0/bin:$PATH" #vscode
export PATH=/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin:$PATH #alias
alias ll="ls -al"
alias pull="git pull"
alias status="git status" #ssh alias
alias serv="sshpass -p '密码' ssh 用户@ip"