bashrc和bash_profile(代码片段)

leee leee     2023-01-12     715

关键词:

在~/.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/[email protected]/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"

textmac.bash_profile-指向.bashrc(代码片段)

查看详情

sh一个bash函数添加到〜/.bash_profile(或〜/.bashrc或其他)(代码片段)

查看详情

.bashrc、.bash_profile 和 .environment 有啥区别?

】.bashrc、.bash_profile和.environment有啥区别?【英文标题】:What\'sthedifferencebetween.bashrc,.bash_profile,and.environment?.bashrc、.bash_profile和.environment有什么区别?【发布时间】:2010-09-2917:56:03【问题描述】:这些年来,我使用了许多不同的... 查看详情

~/.bash_profile(代码片段)

每个用户都可使用~/.bash_profile文件输入专用于自己使用的shell信息,~表示用户的家目录,如root用户就是/root/.bash_profile当用户登录shell时就执行该文件,该文件仅仅执行一次,默认情况下,该文件设置一些环境变量,执行用户的.b... 查看详情

bash配置文件(代码片段)

...profile调用/etc/profile.d/*.sh/etc/profile.d/*.sh用户配置文件:~/.bash_profile调用~/.bashrc~/.bash_profile一般配置用户环境变量~/.bashrc一般配置用户别名按功能划分:profile类:为交互式登录的shell提供配置用于定义环境变量,运行命令和脚本全... 查看详情

mac修改.bashrc/.bash_profile无效,默认的用户配置文件是.zshrc,(代码片段)

...常来说,我们以为是以下几个文件:.profile.bashrc.bash_profilealiasll="ls-l"  结果发现根本没用。为什么呢?原因也简单,MAC默认的是zsh,所以,默认的配置文件是:.zshrc  还有个办法,更... 查看详情

.bash_profile和.bashrc的什么区别

...ell的用户执行此文件.当bashshell被打开时,该文件被读取.~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该 查看详情

VSCode 集成终端不加载 .bashrc 或 .bash_profile

】VSCode集成终端不加载.bashrc或.bash_profile【英文标题】:VSCodeIntegratedTerminalDoesn\'tLoad.bashrcor.bash_profile【发布时间】:2019-01-2002:25:05【问题描述】:我有以下文件来处理shell配置:#~/.bash_profileif[-f~/.bashrc];thensource~/.bashrcfi和#~/.bashrc.... 查看详情

用户身份切换及提权(代码片段)

...比如执行sh,bash,suusername#环境变量文件##个人环境变量:~/.bash_profile~/.bashrc[root@localhost~]#ll~/.bashrc-rw-r--r--1rootroot176Mar2510:55/root/.bashrc[root@localhost~]#ll~/.bash_profile-rw-r--r--.1rootroot176Dec292013/root/.bash_profile##全局环境变量:/etc/profile/etc/prof... 查看详情

用户身份切换及提权(代码片段)

...比如执行sh,bash,suusername#环境变量文件##个人环境变量:~/.bash_profile~/.bashrc[root@localhost~]#ll~/.bashrc-rw-r--r--1rootroot176Mar2510:55/root/.bashrc[root@localhost~]#ll~/.bash_profile-rw-r--r--.1rootroot176Dec292013/root/.bash_profile##全局环境变量:/etc/profile/etc/prof... 查看详情

.bash_profile和.bashrc的区别

Linux下环境变量配置方法梳理(.bash_profile和.bashrc的区别) 在linux系统下,如果下载并安装了应用程序,在启动时很有可能在键入它的名称时出现"commandnotfound"的提示内容。如果每次都到安装目标文件夹内,找到可执行文件来... 查看详情

ubuntu中环境变量文件/etc/profile.profile.bashrc/etc/bash.bashrc之间的区别和联系(代码片段)

Bash登陆(login)的时候,Profile执行的顺序1)先执行全局Profile,/etc/profile2)接着bash会检查使用者的HOME目录中,是否有.bash_profile或者.bash_login或者.profile,若有,则会执行其中一个,执行顺序为:.bash_p 查看详情

OpenSuse linux 上的 .bashrc 或 .bash_profile 在哪里?

】OpenSuselinux上的.bashrc或.bash_profile在哪里?【英文标题】:Whereis.bashrcor.bash_profileonOpenSuselinux?【发布时间】:2010-12-1316:32:03【问题描述】:我正在尝试安装rvm,它希望我编辑.bashrc或.bash_profile文件以包含rvm...但我无法在任何地方... 查看详情

mac设置环境变量path和查看path(代码片段)

...篇Mac系统的环境变量,加载顺序为:/etc/profile/etc/paths~/.bash_profile~/.bash_login~/.profile~/.bashrc/etc/profile和/etc/paths是系统级别的,系统启动就会加载,后面几个是当前用户级的环境变量。后面3个按照从前往后的顺序读取,如果/.bash_pro... 查看详情

6.bash_profile与.bashrc的区别《mr.robot》

...机器login界面登陆、使用ssh登陆或者su切换用户登陆时,.bash_profile会被调用来初始化shell环境Note:.bash_profile文件默认调用.bashrc文件 查看详情

linux下/etc/profile/etc/bashrc~/.bash_profile~/.bashrc文件的区别

...用户执行此文件.当bashshell被打开时,该文件被读取. ~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shel 查看详情

VScode 终端似乎没有在 Windows 上加载 .bashrc 或 .bash_profile

】VScode终端似乎没有在Windows上加载.bashrc或.bash_profile【英文标题】:VScodeterminaldoesn\'tseemtoload.bashrcor.bash_profileonwindows【发布时间】:2019-08-0206:04:37【问题描述】:如果我在VScode中启动一个新的集成终端,它似乎不会加载我的.bashr... 查看详情

浅析linux下的/etc/profile/etc/bashrc~/.bash_profile~/.bashrc文件

 /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行,并从/etc/profile.d目录的配置文件中收集shell的设置;   /etc/bashrc:为每一个运行bashshell的用户执行此文件,当bashshell被打开时,该... 查看详情