.bash-profile

Why do my Bash prompt colors make cursor appear in wrong spot [duplicate]

 ̄綄美尐妖づ 提交于 2021-02-17 03:22:36
问题 This question already has an answer here : Adding ANSI color escape sequences to a bash prompt results in bad cursor position when recalling/editing commands (1 answer) Closed 4 years ago . I've got the following bash prompt: # helper function to set colors function ps1c() { tput setaf $1; } PS1='$(ps1c 243)\h $(ps1c 177)\W $(ps1c 214)$ \[\e[m\]'; When typing, sometimes my cursor returns to the left side of the screen and looks like it's overwriting the prompt. Also, when using the up arrow

How to source an external file in .bash_profile in OSX?

妖精的绣舞 提交于 2021-02-10 13:19:07
问题 I have defined some aliases in my .bash_profile file and aliases work as expected. e.g alias python-server="python -m SimpleHTTPServer 7070" And, When I open new terminal, typing python-server opens up a python server with current directory as root (or "/"). But I have around 10 aliases and I want to backup the aliases So I thought to create an external file which contain these aliases and am trying to source that file from .bash_profile like this source ~/personal/Dropbox/scripts/aliases.sh

How to tell bash not to issue warnings “cannot set terminal process group” and “no job control in this shell” when it can't assert job control?

情到浓时终转凉″ 提交于 2021-01-27 18:23:12
问题 To create a new interactive bash shell I call bash -i . Due to issues with my environment, bash cannot assert job control (I'm using cygwin bash in GNU emacs) and issues warnings ("cannot set terminal process group" and "no job control in this shell"). - I have to live with the disabled job control in my environment, but I would like to get rid of the warning: How can I tell bash not to assert job control and not to issue these warnings? I obviously still want the shell as an interactive one.

adding ~/bin directory in your path [closed]

我怕爱的太早我们不能终老 提交于 2020-12-25 01:04:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Improve this question I need to add ~/bin directory in your path. But I am not sure what the actual command for this is, I know it goes in my .bash_profile Does anyone know this, or a tutorial on how to set up a new .bash_profile for a terminal on a new mac (UNIX) 回答1: Add this to .bash_profile: export PATH="

Bash PS1 window title?

萝らか妹 提交于 2020-11-29 09:29:06
问题 Say I have this as my PS1 PS1='\[\e]0;TITLE\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' it will give me this prompt Steven@Steven-PC ~ $ with a window title as TITLE I understand that this part \e]0;TITLE\a creates the title, but I dont understand why. It just seems like some gibberish. 回答1: The terminal driver looks for output containing that specific code ( \e]0; )and uses everything up to the \a as the terminal window title. 来源: https://stackoverflow.com/questions/10456228/bash-ps1

login script to use machine password for kinit to obtain ticket at login

眉间皱痕 提交于 2020-05-31 04:02:46
问题 I syncronised my passwords/passphrases for logging in to my machine, unlocking my ssh keyfile ( ~/.ssh/id_rsa , see man ssh-keygen ) and for kerberos. When I log in, I enter the password once to access my local machine account, and as a bonus my ssh key file is also unlocked. I'd like to also automate my kerberos authentification, which also uses the same password. Essentially, I want a secure way to achieve the equivalent effect of putting this in my ´~/.bash_profile`: # PASSWORD SHOULD

composer scripts use older php version

霸气de小男生 提交于 2020-02-03 08:37:01
问题 I host more and more sites on webfaction. Great provider! I ran into some problems though which I think are Linux related. Hope someone can help. SSH command php -v defaults to an older version of php, So I created an alias in my .bash_profile : alias composer="php70 $HOME/composer.phar" alias php="php70" When I preform a php -v now it returns PHP 7.0. So far, so good! PHP 7.0.0 (cli) (built: Dec 4 2015 12:58:58) ( NTS ) But now when I run a composer install and put a php -v in the scripts ->

composer scripts use older php version

时光毁灭记忆、已成空白 提交于 2020-02-03 08:36:07
问题 I host more and more sites on webfaction. Great provider! I ran into some problems though which I think are Linux related. Hope someone can help. SSH command php -v defaults to an older version of php, So I created an alias in my .bash_profile : alias composer="php70 $HOME/composer.phar" alias php="php70" When I preform a php -v now it returns PHP 7.0. So far, so good! PHP 7.0.0 (cli) (built: Dec 4 2015 12:58:58) ( NTS ) But now when I run a composer install and put a php -v in the scripts ->

How to .bashrc for root in Docker

烂漫一生 提交于 2020-01-31 21:33:48
问题 I want to give my root user in a ( centos:6 ) Docker container a .bashrc . However, when I run my container, I find that the .bashrc has not been sourced. Can this be done? My build command: ... RUN touch .bashrc RUN echo "iptables -t nat -A OUTPUT -d hostA -p tcp --dport 3306 -j DNAT --to hostB" >> .bashrc ... My run command: docker run -it --cap-add=NET_ADMIN myImage /bin/bash 回答1: Turns out I was adding the file incorrectly. It should be /root/.bashrc rather than just .bashrc . With the

How do sudo environment variables work in linux?

馋奶兔 提交于 2020-01-13 20:29:44
问题 I'm currently perplexed by the following: sudo echo $MYVAR outputs my variable from my .bashrc, but sudo ./test.sh does not, where test.sh is the below executable: #!/bin/sh echo $MYVAR I'm running Ubuntu 14.04. Can someone enlighten me as to what's going on here? 回答1: When you run sudo echo $MYVAR , the environment variable is expanded in your shell ... before the sudo command gets to see it. When you run a script using sudo , that script only sees the environment variables that sudo has