相关疑难解决方法(0)

如何列出所有变量名称及其当前值?

如何列出所有变量名称及其当前值?

不仅包括$HOME, $PWDetc 还包括您定义的任何其他。

command-line bash environment-variables

442
推荐指数
7
解决办法
70万
查看次数

如何设置路径,以便可以通过同一程序从 GUI 和命令行读取它?

我安装了 texlive,我想将其作为环境变量添加到我的 Path 中,以便当我从 GUI 或命令行启动 emacs 时,Emacs AucTeX 可以读取它。到目前为止,我已经了解到 emacs 只读取来自~/.profile.

因此,我的计划是将 texlive 添加到我的路径中,.profile以使 emacs GUI 能够读取它,然后~/profile从中获取源代码.bashrc,以便在我的非登录交互式 GNOME 终端中启动的 emacs 查看路径。

.profile注意:我的主目录中没有文件,仅在我的/etc目录中,我不想碰那个文件,但我.bash_profile的主目录中有一个文件。但是我读到它.bash_profile仅针对交互式登录会话(即我不使用的控制台模式)运行。

我的计划是在我的主目录中创建一个.profile文件并执行以下操作:

第 1 步:创建~/.profile

步骤2:将texlive环境变量添加到path中.profile

export PATH=/usr/local/texlive/2018/bin/x86_64-linux:$PATH
export MANPATH=/usr/local/texlive/2018/texmf-dist/doc/man:$MANPATH
export INFOPATH=/usr/local/texlive/2018/texmf-dist/doc/info:$INFOPATH
Run Code Online (Sandbox Code Playgroud)

步骤 3:.profile来源.bashrc

#Adding this at the bottom or start of .bashrc to source .profile when the terminal is opened.

if [-s ~/.profile]; then;
    source …
Run Code Online (Sandbox Code Playgroud)

bash emacs .profile environment-variables bashrc

5
推荐指数
1
解决办法
2194
查看次数

"export PS1=" 用于自定义 shell 提示

我想自定义我的 shell 提示以包含时间。所以,我做到了export PS1='\t\w\$'

我的提示现在看起来像18:57:37~$. 我不知道如何在它前面加上username@hostname.

另外,我不知道如何改变颜色的每个参数为\t\w,等等。

在所有测试之后,我如何将其设置回默认值?

最后,出口线去哪儿了?我看了看~/.profile,但没有线export PS1='\t\w\$'

command-line bash prompt bashrc ps1

4
推荐指数
1
解决办法
3万
查看次数