(我是 kinna n00bish)
1:我安装了 ubuntu 11.10,然后升级到 12.04。
2:我的 .profile 文件中有一个脚本来关闭我的笔记本电脑的触摸板(它可以工作,并在登录时执行)
3:现在它不会在登录时执行。
4:如果我'source .profile' 脚本仍然有效。
5:仍在使用gnome(如果这很重要)
我需要在登录时运行该脚本,我该怎么办?
我应该将我的个人脚本放在另一个文件中,还是有办法让 ubuntu 再次执行我的文件?
Thx,你们统治!
当我重新启动 Ubuntu 14.04 时,环境变量被设置回默认值,我source .bash_profile每次都必须运行,这很烦人。我通常将我的环境变量保存.bash_profile在主目录中,该目录位于/home/buraktas. 这是文件的文本:
### export JAVA_HOME variable
export JAVA_HOME=/usr/local/dev/jdk1.8.0_20
export PATH=$PATH:$JAVA_HOME/bin
### export M2_HOME
export M2_HOME=/usr/local/dev/maven
export PATH=$PATH:$M2_HOME/bin
### export SCALA_HOME
export SCALA_HOME=/usr/local/dev/scala-2.11.2
export PATH=$PATH:$SCALA_HOME/bin
Run Code Online (Sandbox Code Playgroud)
我将不胜感激任何形式的回应。
我使用主网站上提供的说明安装了 Anaconda,这些说明与此处可见的说明类似:如何在 Ubuntu 上安装 Anaconda?
但是,我发现我必须使用export~/.profile 中的命令手动更改 PATH (根据 Ubuntu 官方说明:https : //help.ubuntu.com/community/EnvironmentVariables)才能让系统了解 ~/anaconda /斌:
export PATH="/usr/local/texlive/2014/bin/x86_64-linux:$PATH"
export PATH="~/anaconda/bin:$PATH"
Run Code Online (Sandbox Code Playgroud)
这已经令人惊讶了,因为 Anaconda 应该能够在安装过程中自己正确地解决问题。
现在,我遇到的另一个问题是,当我python在终端中运行时,它默认使用 /usr/lib/python... 中的 Python,而不是 ~/anaconda/bin/python。
我该如何解决?
每次登录后我都会收到此错误:
Error found when loading /home/[myusername]/.profile:
stty: standard input: Inappropriate ioctl for device
Run Code Online (Sandbox Code Playgroud)
因此,会话将无法正确配置。您应该尽快解决问题。
我该如何解决?这是一个烦人的弹出窗口,每次登录都必须单击(并且此错误还会阻止我的桌面背景更改持续存在)。谢谢!
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running …Run Code Online (Sandbox Code Playgroud) 我的.profile主目录中的文件中有以下行:
alias flux='redshift -O 2500'
但是每当我登录并输入时,flux我都会得到一个flux is not a recognized command.
然后我再次输入source .profile并输入flux,它完美地工作。
我在 Ubuntu 20.04
为什么aliasin my.profile不工作,除非我做 a source .profile?
编辑:我现在明白这.profile不是放置它的正确位置。
我最终.bashrc使用以下source命令从文件中加载别名:
for file in ~/.dotfiles/.{exports,aliases}; do
[ -r "$file" ] && source "$file"
done
unset file
Run Code Online (Sandbox Code Playgroud) 我最近安装了一些软件,需要将它们的bin/目录添加到我的PATH. 目前没有任何异常。但是我决定聪明点,并重写了我的一部分,.profile这样我就不必一遍又一遍地复制/粘贴相同的几行代码。这是我的想法:
# Create an array with directories to be added to PATH
declare -a addpath=("$HOME/bin" "$HOME/.cabal/bin" "/opt/vert.x/current/bin")
# Add directories recursively
for dir in "${addpath[@]}"; do
if [ -d "$dir" ]; then
PATH="$dir:$PATH"
fi
done
Run Code Online (Sandbox Code Playgroud)
我认为这很有效......直到我重新启动我的电脑并在尝试登录时被锁定在我的会话之外。我花了一段时间才弄清楚这实际上是因为我的.profile; 一旦我将这些行注释掉,我就可以登录我的会话而不会被退回。
我的问题是;这些行我做错了什么?是否有语法错误?有没有其他/更好的方法来做到这一点?发生了什么?
我希望我的提示显示:
当前(绝对)工作目录,以绿色和
在新行中,美元符号和一个空白区域。
我正在使用这条线 .profile
export PS1='\e[0;32m$(pwd)\n\e[m$ '
所以当在 eg 时Desktop,我的提示看起来像这样:
然而,有时当点击向上箭头重新运行以前的命令时,在提示开始时会出现一个随机字符序列,除非我按下回车键,否则它似乎不会消失,例如
我从来没有打过cd cd Desktop命令。最奇怪的部分是退格键甚至不会删除cd上面两个命令中的第一个!
有什么建议?
我已经通过 *.run 文件从官方网站安装了 Qt 5.6。安装目录在我的主文件夹中。当我跑
qmake --version
Run Code Online (Sandbox Code Playgroud)
我收到以下消息:
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
Run Code Online (Sandbox Code Playgroud)
我认为问题在于操作系统没有在正确的目录中查找 qmake(我的主文件夹中安装了 Qt)。
如何告诉操作系统在我的主文件夹中搜索 Qt?
Ubuntu 18.04.4(几周前从 18.04.3 自动升级)
/bin/bash
从 Gnome shell 登录后,当屏幕为纯紫色且桌面出现之前,会出现此消息:
Error found when loading /home/hfinger/.profile:
/home/hfinger/.profile: line 1: #: command not found
/home/hfinger/.bashrc: line 1: syntax error near unexpected token '('
/home/hfinger/.bashrc: line 1: '# ~/.bashrc: executed by bash(1) for non-login shells.'
As a result the session will not be configured correctly.
You should fix the problem as soon as feasible.
Run Code Online (Sandbox Code Playgroud)
问题是,有什么问题?我已经搜索过 AskUbuntu,但似乎没有人遇到过这个确切的问题。我不认为这是升级,因为在出现此问题之前它已经运行了大约一个月。
我从来没有接触过这两个文件,因为我很高兴让系统创建和配置它们。此外,我尽量让 Ubuntu 保持原样,以避免在升级到新版本后必须恢复设置。值得一提的是,以下是每个文件的第一行:
.profile, line 1: # ~/.profile: executed by the command interpreter for login shells.
.bashrc, line …Run Code Online (Sandbox Code Playgroud) 我只是搞砸了~/.profile,试图添加一些东西PATH,但看起来我的代码中有语法错误,现在登录屏幕功能不起作用,我可以使用ctrlshiftf1tty 登录但基本命令,例如sudo和ls将不起作用因为~/.profile坏了。我该如何解决?