[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash-question



On Mon, Dec 25, 2000 at 10:21:52AM +0100, Stephan Kulka wrote:
> That's quite a newbie question, but I don't know what to do.
> Yesterday I made a new directory for programming, I added this directory
> with export to my PATH. Yesterday everything went fine, but today I always
> get the error command not found. I checked my PATH, it i so.k. and the
> compiled programs work when I type ./foo
> What's wrong??

Today you logged on afresh, and so the path has to be set again.
To free you from the burden to ajust your path (and other prefs.)
each time you logon, most shells alow you to set those prefs. in a
*rc (run-command) file. Bash (probably the shell you are using)
has ~/.bash_profile and ~/.bashrc.  The first gets run for each
'login' shell, the latter only for non-login shells. (man bash
for more info; ~/ gets translated to the full path to your home
directory)  So you could have the following in ~./bash_profile:

  # ~/.bash_profile: executed by bash(1) for login shells.

  ### 'source' ~/.bashrc if and only if it exists
  if [ -e ~/.bashrc ]; then
     source ~/.bashrc
  fi

  ### default file protection, no writing for others
  umask 002

  ### make less smarter, uncompressing/untarring etc on the fly
  eval $(lesspipe)
  #eval $(lessfile)

  ### the editor of choice for mutt etc
  export EDITOR='xemacs -nw'


  ### startup an extra Xwindows automatically iff I logon on virtual screen 6
  if [ `tty` = /dev/tty6 ]; then
     exec startx -- :1
  fi


and in your ~/.bashrc you then set the PATH variable like:

  # ~/.bashrc: executed by bash(1) for non-login shells.

  ### you can change your path here, either put your bin upfront
  ### (disadvantage: you now easily overrule genuine system commands)
  #PATH = ~/your-bin:$PATH
  ### or put it at the end
  ### (disadvantage: you now can't overrule system commands:)
  PATH = $PATH:~/your-bin
  ### Normally you're better of using ./your-command

  export LESSCHARSET=latin1

  #no dups in history, skip space prepended lines too
  export HISTIGNORE="&: *"

-- 
groetjes, carel



Reply to: