I am trying to create an alias and I have added these lines in ~/.bash_aliases
alias server-python='open http://localhost:8000 && python -m SimpleHTTPServer'
alias ssh-saad='ssh saad@<my-server>' <my-server> is replaced by the ip add of my server. So in my ~/.bashrc file these lines are uncommented
if [ -f ~/.bash_aliases ]; then
.
The bash man page says:
"When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, "
I can see that bash.bashrc is executed because I put echo in it, but .bashrc is not.
On one of my Ubuntu 11.10 servers, when I use sudo -i to become the root user, root's .bashrc is not being executed.
After a recent upgrade to 12.04, auto tab completion was disable in /etc/bash.bashrc. I uncommented the following lines:
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
I tried to then run source /etc/bash.bashrc and . /etc/bash.bashrc but neither reloaded the config. They just gave me the error -sh: 1: source: not found.
I have 12.04 server minimal running on my VPS. When I ssh into the server, only $ is showing at the prompt for each prompt. There's no typical <directory> <username>$, no autocompletion (bash-completion is installed), and no use of arrow key, etc.
My /etc/profile code is:
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
.
Terminal shows this
bash: /home/atlas/.bashrc: line 73: syntax error near unexpected token ['
bash: /home/atlas/.bashrc: line 73:if [ -x /usr/bin/dircolors ] ; then '
I've tried to fix it using
"cp /ect/skel/.bashrc ~/"
And I get this "cp: cannot stat `/ect/skel/.bashrc': No such file or directory"
I'm unsure of why this is doing this and how to fix it.
I just updated to fedora 18, and I find the auto completion does not work properly. I use bash for years..
auto completion works fine for command like 'cat', 'ls', 'cd', but for 'vi', it does not. It always append 'bash' after and complains aroread: command not found..
Hi I am curious if it is possible to execute a bash script inside bash rc. It would seem to create a infinite loop unless there was some way to tell it to not try and start a new shell.
Here is an example
bash_script.sh:
#!/bin/bash
echo Hello World
.bashrc
export HELLO_WORLD=$(bash_script.sh)