[ Pobierz całość w formacie PDF ]
.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.fvwmrc Read by an X window manager, fvwm.All of these les should be located in your home directory, if they exist at all.The.xinitrc is a simple shell script that gets run when X is invoked.It can do anything anyother shell script can do, but of course it makes the most sense to use it for starting up various Xprograms and setting window system parameters.The last command in the.xinitrc is usually thename of a window manager to run, for example usr bin X11 twm.What sort of thing might you want to put in a.xinitrc le? Perhaps some calls to the xsetrootprogram, to make your root background window and mouse cursor look the way you want themto look.Calls to xmodmap, which tells the server3 how to interpret the signals from your keyboard.Any other programs you want started every time you run X for example, xclock.Here is some of my.xinitrc; yours will almost certainly look di erent, so this is meant only asan example:! bin shThe first line tells the operating system which shell to use in3The server" just means the main X process on your machine, the one with which all other X programs mustcommunicate in order to use the display.These other programs are known as clients", and the whole deal is calleda client-server" system.98 CHAPTER 9.I GOTTA BE ME!interpreting this script.The script itself ought to be marked asexecutable; you can make it so with "chmod +x ~.xinitrc".xmodmap is a program for telling the X server how to interpret yourkeyboard's signals.It is *definitely* worth learning about.Youcan do "man xmodmap", "xmodmap -help", "xmodmap -grammar", and more
[ Pobierz całość w formacie PDF ]