我安装了 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) 我遇到了一个问题,我只能使用nano命令编辑 .bashrc 或 .zshrc 文件。
当我输入code .bashrc它时,它会打开一个空的 .bashrc 文件。随着nano它工作在壳体内,并通过适当的命令显示文件nano .bashrc,但我通过纳米恨编辑文件和我宁愿做在Visual Studio中,任何想法如何解决这一问题,使Visual Studio代码可以阅读。文件?
地狱,即使在使用 编辑普通文件(即未使用 隐藏的文件.)时code,虽然它可以工作,git status但不会注册更改,但如果文件使用nano. 作为一个不喜欢通过 shell 进行编辑的人,这让我非常沮丧,这让我考虑回到 Git Bash ......尽管我更喜欢在 WSL 上使用 zsh。
command-line hidden-files bashrc windows-subsystem-for-linux visual-studio-code
cd进入每个选项卡中的不同文件夹(即:运行唯一的命令)。 我想要编写此脚本,以便我可以单击桌面上的脚本并让它打开终端,就像我想要的日常开发环境一样。
\n\n我有这个脚本来尝试打开 3 个终端选项卡,并在选项卡中运行独特的命令:
\n\n#!/bin/bash\n\ngnome-terminal --tab -- bash -c "source $HOME/.bashrc && set-title hey; exec bash"\ngnome-terminal --tab -- bash -c "cd ~; exec bash"\ngnome-terminal --tab\nRun Code Online (Sandbox Code Playgroud)\n\n当我使用 运行它时./open_tabs.sh,它会打开 3 个新选项卡,但不幸的set-title是无法设置选项卡标题!我在打开的选项卡中收到此错误:
bash: set-title: command not found\nRun Code Online (Sandbox Code Playgroud)\n\n我已经像这样set-title定义了一个函数~/.bashrc。其目的是在任何终端窗口的顶部设置标题字符串。当我手动使用它时它工作得很好。例如:set-title hey how are you?将输入“嘿,你好吗?” 在我的终端窗口的顶部。
# From: https://unix.stackexchange.com/questions/177572/how-to-rename-terminal-tab-title-in-gnome-terminal/566383#566383\nset-title() {\n # If the …Run Code Online (Sandbox Code Playgroud) 最近,我在水平调整 gnome-terminal 窗口大小时注意到一个奇怪的问题。
包装 bash 行时存在一个错误:行被复制。我真的不知道这是否正常。
我创建了一个 GIF 来显示问题:
我阅读了其他类似的错误和修复。他们说要验证文件$PS1中的 var.bashrc并修复任何未用\[\]. 我将.bashrc文件重置为默认值,如下所示:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, …Run Code Online (Sandbox Code Playgroud) 我现在正在参加 Hackathon,所以如果有人能尽快回答这个问题,你会帮我一个大忙。
我在 .bashrc 中编写了一个名为 ls() 的函数,如下所示:
ls() {
if(some condition);
do something
else
ls; #(CALL TO ORIGINAL ls SYSTEM CALL)
fi
}
Run Code Online (Sandbox Code Playgroud)
但是这里到了else部分,就进入了无限循环
如何在 else 中调用原始 ls 系统调用,或者,如何使 ls 在一个文件夹中的行为与其他文件夹中的行为不同。
我的 .bashrc 文件夹中有一个不错的小 bash 别名,它允许我启动 Tomcat 运行而无需先 cd 进入文件夹,例如
alias startTomcat="cd ~/apache-tomcat-7.0.34/bin/ && ./startup.sh"
Run Code Online (Sandbox Code Playgroud)
但是,当我startTomcat在终端中运行时,我从启动的文件夹中启动,现在我的终端驻留在~/apache-tomcat-7.0.34/bin/. 当然,这是预期的行为,但我想要做的是运行命令而不在不同的文件夹中结束。
我可以保存原始位置,然后在我的 .bashrc 文件中返回它,或者在不cd退出原始文件夹的情况下运行 startup.sh吗?
谢谢!!
这是初始屏幕,我在Ubuntu 12.04获取,当我打开一个终端(Ctrl+ Alt+ T):

即终端上的文字是:
bash: /bin: Is a directory
chase@chase-desktop:~$ gedit ~/.bashrc
chase@chase-desktop:~$ source ~/.bashrc
bash: /bin: Is a directory
chase@chase-desktop:~$
Run Code Online (Sandbox Code Playgroud)
为什么会出现这个样子?
在此之前,我在终端上工作并编辑了.bashrc很多次,但我没有收到这些消息。
Ubuntu 新手,所以如果我说的很奇怪,请原谅......我真正想做的就是将我的 ls 命令更改为 ls --color=always -ragX
解决了... Alias 会做得很好。现在,每次我登录时都运行它(从 Putty SSH 到命令行)我.bashrc在我的主目录中创建并输入
alias ls='ls --color=always -ragX'
Run Code Online (Sandbox Code Playgroud)
保存、退出并返回
打字 vi
看起来.bashrc文件没有运行?怎么办?
我发现了这个名为Solarize 的漂亮颜色库,它有望通过彩色终端增强我的黑客体验。
我不是在哪里添加 Solarize 文件进行更改。如果您想使用tmux,我找到了一些说明,确实我安装了 tmux 和脚本,但我的颜色并没有真正改变。
我有 bash 问题,它正在寻找丢失的字符,但我找不到它。也许还有其他问题?
每次打开终端时都会出现此错误:
bash:/home/chill/.bashrc:第 132 行:寻找匹配的“”时出现意外 EOF
.bashrc文件内容:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history …Run Code Online (Sandbox Code Playgroud)