bash脚本中的源〜/.bashrc无法正常工作 [英] source ~/.bashrc from bash script does not work

查看:59
本文介绍了bash脚本中的源〜/.bashrc无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个脚本,以重新加载bashrc一次,但是它不起作用.

I am trying to create a script to be reload bashrc once but it did not work.

#!bin/bash
source ~/.bashrc
rm reloader.sh

推荐答案

您需要使用 source 来运行脚本:

You need to use source to run the script:

source reloader.sh

如果仅将其作为命令运行,它将在新进程中运行,因此 .bashrc 所做的任何更改都不会影响您的原始Shell进程.

If you just run it as a command, it will run in a new process, so none of the changes that .bashrc makes will affect your original shell process.

这篇关于bash脚本中的源〜/.bashrc无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆