[ Pobierz całość w formacie PDF ]
.What that does is includesthe value of any PATH variable previously set in my new PATH.Where would the old variable be set?The le etc profile serves as a kind of global.bash profile that is common to all users.Havingone centralized le like that makes it easier for the system administrator to add a new directory toeveryone's PATH or something, without them all having to do it individually.If you include the oldpath in your new path, you won't lose any directories that the system already setup for you.You can also control what your prompt looks like.This is done by setting the value of theenvironment variable PS1.Personally, I want a prompt that shows me the path to the currentworking directory|here's how I do it in my.bashrc:export PS1='$PWD 'As you can see, there are actually two variables being used here.The one being set is PS1 , andit is being set to the value of PWD, which can be thought of as either Print Working Directory"or Path to Working Directory".But the evaluation of PWD takes place inside single quotes.Thesingle quotes serve to evaluate the expression inside them, which itself evaluates the variable PWD.If you just did export PS1=$PWD, your prompt would constantly display the path to the currentdirectory at the time that PS1 was set , instead of constantly updating it as you change directories.Well, that's sort of confusing, and not really all that important.Just keep in mind that you needthe quotes if you want the current directory displayed in your prompt.You might prefer export PS1=' $PWD ' , or even the name of your system: export PS1=` hostname` ' '.Let me dissect that last example a little further.That last example used a new type of quoting, the back quotes.These don't protect something|in fact, you'll notice that hostname" doesn't appear anywhere in the prompt when you run that.What actually happens is that the command inside the backquotes gets evaluated, and the outputis put in place of the backquotes and the command name.Try echo ` ls` or wc ` ls`.As you get more experienced using the shell, this technique getsmore and more powerful.96 CHAPTER 9.I GOTTA BE ME!There's a lot more to con guring your.bashrc, and not enough room to explain it here.You canread the bash man page for more, or ask questions of experienced Bash users.Here is a complete.bashrc for you to study; it's fairly standard, although the search path is a little long.some random stuff:ulimit -c unlimitedexport history_control=ignoredupsexport PS1='$PWD 'umask 022application-specific paths:export MANPATH= usr local man: usr manexport INFOPATH= usr local infoexport PGPPATH=$ HOME.pgpmake the main PATH:homepath=$ HOME : ~ binstdpath= bin: usr bin: usr local bin: usr ucb : etc: usr etc: usr gamespubpath= usr public bin: usr gnusoft bin: usr local contribs binsoftpath= usr bin X11: usr local bin X11 : usr TeX binexport PATH=.: $ homepath : $ stdpath : $ pubpath : $ softpathTechnically, the curly braces were not necessary, because the colonswere valid delimiters; nevertheless, the curly braces are a goodhabit to get into, and they can' t hurt.aliasesalias ls="ls -CF"alias fg1="fg 1"alias fg2="fg 2"alias tba="talk sussman@tern.mcs.anl.gov"alias tko="talk kold@cs.oberlin.edu"alias tji="talk jimb@totoro.bio.indiana.edu"alias mroe="more"alias moer="more"alias email="emacs -f vm"alias pu=pushdalias po=popdalias b="~.b"alias ds=dirsalias ro="rm *~; rm.*~"alias rd="rmdir"alias ll="ls -l"alias la="ls -a"alias rr="rm -r"alias md="mkdir"alias ed2="emacs -d floss: 0 -fg "grey95 " -bg "grey50 ""function gco9.2.THE X WINDOW SYSTEM INIT FILES 97gcc -o $1 $1.c -g9.2 The X Window System Init FilesMost people prefer to do their work inside a graphical environment, and for Unix machines, thatusually means using X.If you're accustomed to the Macintosh or to Microsoft Windows, the XWindow System may take a little getting used to, especially in how it is customized.With the Macintosh or Microsoft Windows, you customize the environment from within theenvironment: if you want to change your background, for example, you do by clicking on the newcolor in some special graphical setup program.In X, system defaults are controlled by text les,which you edit directly|in other words, you'd type the actual color name into a le in order to setyour background to that color.There is no denying that this method just isn't as slick as some commercial windowing systems.I think this tendency to remain text-based, even in a graphical environment, has to do with the factthat X was created by a bunch of programmers who simply weren't trying to write software thattheir grandparents could use.This tendency may change in future versions of X at least I hope itwill , but for now, you just have to learn to deal with more text les.It does at least give you veryexible and precise control over your con guration.Here are the most important les for con guring X:.xinitrc A script run by X when it starts up.twmrc Read by an X window manager, twm
[ Pobierz całość w formacie PDF ]