Perlbrew通过vagrant provision.sh安装(Perlbrew installation through vagrant provision.sh)

编程入门 行业动态 更新时间:2024-10-24 00:27:06
Perlbrew通过vagrant provision.sh安装(Perlbrew installation through vagrant provision.sh)

我想自动将perlbrew安装到vagrant box中。 我用.sh文件来完成这个。

provision.sh

apt-get update sudo -H -u vagrant bash -c " \curl -kL https://install.perlbrew.pl | bash" sudo -u vagrant bash -c "source ~/perl5/perlbrew/etc/bashrc"

ssh进入流浪者后,我期待着

$ which perlbrew

将返回

/home/vagrant/perl5/perlbrew/bin/perlbrew

但遗憾的是它什么也没有回报。

I want to automate the installation of perlbrew into the vagrant box. I use .sh file to accomplish this.

provision.sh

apt-get update sudo -H -u vagrant bash -c " \curl -kL https://install.perlbrew.pl | bash" sudo -u vagrant bash -c "source ~/perl5/perlbrew/etc/bashrc"

After ssh into the vagrant i expect that

$ which perlbrew

will return

/home/vagrant/perl5/perlbrew/bin/perlbrew

but unfortunately it returns nothing.

最满意答案

source ~/perl5/perlbrew/etc/bashrc命令应用的设置无法在另一个bash会话中显示(并且SSH会话执行新的bash进程)。

您需要将命令source ~/perl5/perlbrew/etc/bashrc到其中一个bash“rc”文件中。

对于具有以下命令的单个用户:

echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.bashrc

对于具有以下命令的所有用户:

echo "source ~/perl5/perlbrew/etc/bashrc" >> /etc/bash.bashrc

这样每次启动一个新的bash会话时,它都会运行source ~/perl5/perlbrew/etc/bashrc并应用设置。

There is no way the settings applied by your source ~/perl5/perlbrew/etc/bashrc command would be visible in another bash session (and a SSH session executes a new bash process).

You need to add the command source ~/perl5/perlbrew/etc/bashrc to one of the bash "rc" files.

For a single user with the following command:

echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.bashrc

For all users with the following command:

echo "source ~/perl5/perlbrew/etc/bashrc" >> /etc/bash.bashrc

This way every time a new bash session is started, it will run source ~/perl5/perlbrew/etc/bashrc and apply the settings.

更多推荐

本文发布于:2023-08-02 01:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1367990.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:vagrant   Perlbrew   provision   installation   sh

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!