如果运行 bash if [ -n "$BASH_VERSION" ]; 那么

如果运行 bash if [ -n "$BASH_VERSION" ]; 那么

我对 Linux 完全陌生,不知道该怎么做。我想做的是:我想在 Ubuntu 18.04.3 LTS 64 位上安装 Stata 16。我按照 stata 安装指南操作,到目前为止一切正常。现在我被要求执行以下操作:

如果你使用 bash 、 sh 或 ksh ,你的 .profile (在你的主目录中)中有一行内容如下

PATH="/bin:/usr/bin:/usr/local/bin:$HOME/bin"

编辑文件并将 /usr/local/stata 添加到列表中:

PATH="/bin:/usr/bin:/usr/local/bin:$HOME/bin:/usr/local/stata"

我的问题是:我的 .profile 中没有像上面那样的行。我的 .profile 内容为:

如果运行 bash if [ -n "$BASH_VERSION" ]; 那么

# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then   . "$HOME/.bashrc"
fi fi

设置 PATH 使其包含用户私有的 bin(如果存在) if [ -d "$HOME/bin" ] ; then

PATH="$HOME/bin:$PATH" fi

设置 PATH 使其包含用户私有的 bin(如果存在) if [ -d "$HOME/.local/bin" ] ; then

PATH="$HOME/.local/bin:$PATH" fi

我的主目录中唯一的文件是 .bash_history、.bash_logout、.bashrc、.profile 和 .sudo_as_admin_successful。

我需要做什么才能将 stata 纳入 PATH?有人能帮我指导一下这些步骤吗?

附带问题:我的键盘有些错误。它无法再写出需要 AltGr 键的符号。

提前谢谢您!

答案1

我做了类似的事情,通过将其添加到我的脚本中来将我的脚本添加到我的路径中~/.bashrc

export PATH=$PATH:$HOME/scripts

因此,补充一下统计在你的路径中添加:

export PATH=$PATH:/usr/local/stata

相关内容