- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
当我运行 Cygwin.bat
时,我的所有自定义内容都在 .bash_profile
中运行,但是当我只是运行 bash
我在 .bash_profile
中的所有东西都没有工作,我只是得到了像 root@comp:/mnt/c/cygwin64#
这样的有线前缀(作为我当前的目录)
有什么方法可以在运行 bash
时获得与运行 Cygwin.bat
时相同的结果吗?
Cygwin.bat
的内容是:
@echo off
C:
chdir C:\Tools\cygwin64\bin
bash --login -i
最佳答案
正如@matzeri 在评论中指出的那样,cygwin.bat
使用--login
选项调用bash
,这会创建一个交互式登录外壳。没有 --login
选项的 bash
会创建一个交互式 shell 而不是 login shell。
根据 bash man page :
When bash is invoked as an interactive login shell, or as a non-interactive shell with the
--login
option, it first reads and executes commands from the file/etc/profile
, if that file exists. After reading that file, it looks for~/.bash_profile
,~/.bash_login
, and~/.profile
, in that order, and reads and executes commands from the first one that exists and is readable. The--noprofile
option may be used when the shell is started to inhibit this behavior.When an interactive shell that is not a login shell is started, bash reads and executes commands from
~/.bashrc
, if that file exists. This may be inhibited by using the--norc
option. The--rcfile
file option will force bash to read and execute commands from file instead of~/.bashrc
.
我的 ~/.bash_profile
只有一行:
source ~/.bashrc
然后我将所有 conf 放在 ~/.bashrc
中。
关于windows - 运行 'Cygwin.bat' 和仅运行 'bash' 时的区别(.bash_profile 与 .bashrc),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43937077/
我想运行一个名为“showfiles”的命令,该命令将运行命令“defaults write com.apple.finder AppleShowAllFiles TRUE”和“killall Fin
我向 .bash_profile 添加了一些设置,并且关闭/打开终端似乎没有我在那里添加的路径,即执行 echo $BLAH结果为空行。 (运行最新版本的ubuntu) 我应该改用 .profile
我试图在终端中自定义提示。为此,我尝试使用vim编辑.bash_profile,但最终得到了.bash_profile.swp文件。在网上找到一些帖子之后,我在vim中使用了:recover命令,该命
因此,我正在安装一些用于编码和个人使用的东西,并且需要在终端中运行它(如果您未阅读标题,则在Mac上运行)。 ~/.bash_profile 它只是说允许被拒绝,我正在运行OSX 10.8.4 Mou
我的 .bash_profile 中有一些简单的别名(OS X El Capitan,10.11.6)。有时,我想要多个别名来做同样的事情。例如,我有一个文件夹,它是我编程项目的起点。目前,我有一个代
我正在尝试在Mac上使用Eclipse/Maven进行开发,并且在设置环境变量时没有.bash_profile。我做ls -a,现在还不在那里。我看到一个.bash_history和.bash_ses
我在 中设置了一些别名.bash_profile 在我的 Max OS X 上。 它有效,但是当我打开一个新标签时,我总是必须加载我的 .bash_profile 文件与此命令: source ~/.
我在 ~/.bash_profile 中设置了一个别名,如下所示: alias lcmt="git show $(git log --oneline | awk '{print $1;}' | hea
这个问题在这里已经有了答案: Make a Bash alias that takes a parameter? (24 个答案) 关闭 4 年前。 我正在尝试创建一个别名,它将创建一个文件并在 V
这个问题在这里已经有了答案: 关闭 12 年前。 Possible Duplicate: How do I find .bash_profile and add to my shell's init
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
我在我的 Mac OS X 上向我的 .bash_profile 添加了一些东西,但它们给出了一个错误。这是我现在启动终端时的全部文本日志: Last login: Thu Oct 25 23:10:
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
如何重新加载文件 .bash_profile从命令行? 我可以通过退出并重新登录让 shell 识别对 .bash_profile 的更改,但我希望能够按需执行此操作。 最佳答案 只需输入 sourc
我正在尝试从别名 (macosx) 执行 python 文件。 这可能吗? alias execute ='python path/file.py' 我正在尝试这样,但不起作用,有什么建议吗? 谢谢
我正在使用 CentOS。我从 rpm 安装了 Java8。 按照教程我这样做了: export JAVA_HOME=jdk-install-dir export PATH=$JAVA_HOME/bi
我正在尝试使用此链接中的第 5 步安装 Python 虚拟环境 Install OpenCV 3 on macOS with Homebrew (the easy way) 我在正确配置这个文件时遇到
我已经安装了 Hadoop,每次我想运行它时,首先我必须这样做: source ~/.bash_profile 否则它不会识别命令 hadoop 这是为什么? 我在 OSX 10.8 上 最佳答案 现
您好,我在远程设备上运行 linux angstrom 发行版,我将 .bash_profile 和 .bashrc 添加到/home/root,因为它们不存在,我在其中写了这个 PATH=/opt/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 关闭 4 年前。 这个问题似乎不是关于 a specific programming problem,
我是一名优秀的程序员,十分优秀!