Jabrick
October 20th, 2011, 03:52 AM
So I am trying to configure my ~.bashrc file, with an if statement.
#
# ~/.bashrc
#
#If not running interactively, don't do anything#
[[ $- != *i* ]] && return
#Aliases#
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias mplayerx='mplayer -heartbeat-cmd "xscreensaver-command -deactivate"'
alias wireless='wicd-curses'
alias background='feh --bg-scale'
#Customizing PS1#
export PS1='\[\e[1;35m\][reza]\W>\[\033[0m\] '
directory=$(pwd)
if [$directory == /home/bob]; then
echo "You are in home directory"
fi
And when I start the terminal I get this message.
bash: [/home/bob: No such file or directory
In the end my ultimate goal is for
PS1 to show my working directory (\W) only when I'm not in home.
P.S
Do I have a second problem, because this bash script only runs when you start the terminal? If so what can I do to solve my problem.
~
#
# ~/.bashrc
#
#If not running interactively, don't do anything#
[[ $- != *i* ]] && return
#Aliases#
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias mplayerx='mplayer -heartbeat-cmd "xscreensaver-command -deactivate"'
alias wireless='wicd-curses'
alias background='feh --bg-scale'
#Customizing PS1#
export PS1='\[\e[1;35m\][reza]\W>\[\033[0m\] '
directory=$(pwd)
if [$directory == /home/bob]; then
echo "You are in home directory"
fi
And when I start the terminal I get this message.
bash: [/home/bob: No such file or directory
In the end my ultimate goal is for
PS1 to show my working directory (\W) only when I'm not in home.
P.S
Do I have a second problem, because this bash script only runs when you start the terminal? If so what can I do to solve my problem.
~