|
Customizing the UNIX Shell
The UNIX shell is a actually a user program that the kernel runs for you when you log in. There is usually more than one shell available on most UNIX systems. The most common shells available on UNIX systems are the Bourne Shell (sh), the C Shell (csh) and the Korn shell (ksh). Here is a summary of features available on these three shells, adapted from the Hewlett Packard "Beginner's Guide to HPUX.
Choosing your shellIt is possible to invoke any available shell from within another shell. To start a new shell, you can simply type the name of the shell you want to run, ksh, csh, or sh.It is also possible to set the startup shell for all your future sessions. The shell for your account is stored in the system database /etc/passwd, along with the other information about your account. To change your shell, use the chsh command The cshs command requires one argument, the name of the shell you want as your . To change tour shell to the C shell, you could enter the command chsh /bin/csh On ISU's HP-UX system, the available shells are /bin/sh, /bin/posix/sh, and /bin/csh. The shell for accounts is /bin/posix/sh, which is, for all practical purposes, the same as ksh.
file access permissionsWhenever you create a file or directory in a UNIX filesystem, the newly created file or directory is stamped with a set of permissions. That set of permissions is stored in a variable called the umask . You can change the value of umask to suit your preferences. To see the current value of the umask variable, enter the shell command: umaskThe umask is stored as an octal (base 8) number, that defines which permissions to deny. As you recall, three kinds of file permissions (read, write, and execute) are given for each of three classes of users (owner, group, and others). Each of the nine permissions is specified as a zero (allow access), or a one (deny access). "execution_environment_customumask To set your umask to deny write permission to group and others, use the command umask 022 To deny all access to group and others, use the command umask 077 Some versions of UNIX provide a more user-friendly way of specifying your umask. In HP-UX sh-posix (or ksh), you are allowed to specify the access permissions in manner of the chmod command. The command umask u=rwx,g=r,o=r would set the umask to deny write and execute permissions to the group, and to others. That kind of command syntax will not work in HP-UX's C shell or Bourne shell. The HP-UX posix shell also allows the use of the command umask -S to print your umask setting in a more readable fashion. Customizing with user login scriptsThe remainder of this section describes some of the ways you can initialize ksh, by presenting the user login scripts provided to users of ISU's CWIS machine. The scripts have been annotated with descriptions of the purpose of each set of commands.The .profile file !/bin/posix/sh ****************************************************************************** Run the script .shrc in every subshell. ****************************************************************************** ENV$HOME/.shrc;export ENV ****************************************************************************** Leave a sign of last login in user's home directory Remove this line if you don't want such records left. All logins are logged elsewhere, anyway. ****************************************************************************** touch $HOME/.lastlogin chmod 600 $HOME/.lastlogin ****************************************************************************** THREE TYPES OF TERMINAL-CHOOSING MECHANISMS ARE PRESENTED BELOW. ONLY ONE SHOULD BE USED. AUTOMATIC DETECTION OF TERMINAL TYPE IS THE . ****************************************************************************** ****************************************************************************** Uncomment the following line (i.e. remove at the beginning of line) to make it so you're prompted for terminal type at login (rather than having term type hard-coded or having the system automatically detect your terminal type). Replace 'vt220' with another term type if you want a different terminal type presented with the user prompt. ****************************************************************************** eval ` tset -s -Q -m :?vt220` ****************************************************************************** Uncomment the following line (i.e. remove at beginning of line) if you want to hard-code a terminal type. Replace 'vt220' with any desired terminal type. Use this option only if you are always using the same type of terminal, and if the system doesn't seem to properly detect your terminal type. ****************************************************************************** TERM=vt220 ****************************************************************************** If you chose either of the above terminal-choosing options, comment out the following section from 'if' to 'fi' (insert a at the beginning of each line). Otherwise, the terminal handling for terminal access is to have the system attempt to detect your terminal type. ****************************************************************************** if [ ${TERM}XX] then TERM=`ttytype` case $TERM in *2382* | *2392* | *2393* | *2394* | *2397* | *2621* ) TERMhp;; *2621* | *2622* | *2623* | *2624* | *2625* | *2626* ) TERMhp;; *2627* | *2628* | *2640* | *2641* | *2644* | *2645* ) TERMhp;; *2647* | *2648* | *2649* | *150* | *70092* | *70094* ) TERMhp;; esac fi ***************************************************************************** Leave this line alone: it applies for all terminal-setting options ***************************************************************************** export TERM ****************************************************************************** Set up the terminal: ****************************************************************************** stty hupcl ixon ixoff ienqak -parity stty erase ^Hkill ^Uintr ^Ceof ^Dsusp ^Ztabs ***************************************************************************** Display little menu of options ***************************************************************************** /usr/local/bin/menu
The .shrc file !/bin/posix/sh ***************************************************************************** Set permissions so that you can read and write all files, and that others can't. Changing this can potentially mess up the security of your account, so make sure you know what you're doing before changing this. ***************************************************************************** umask 077 ****************************************************************************** set paths: PATH tells the shell where to look for programs/commands when you type command or program names. MANPATH tells the shell where to look for unix 'man' pages. NNTPSERVER tells newsreaders to get usenet news from the cwis computer. ****************************************************************************** PATH=$HOME/bin:.:/bin/posix:/bin:/usr/bin:/usr/contrib/bin:/usr/local/bin:/usr/bin/X11:/usr/ local/bin/X11:/usr/contrib/bin/X11:/share/gen/bin:/share/X11/bin MANPATH=/usr/man:/usr/local/man:/usr/contrib/man:/share/gen/man:/share/X11/man NNTPSERVER=localhost ****************************************************************************** Set up the shell environment variables: HOST and GROUPNAME get set for old cwis menus. If you want an editor other than pico (like vi or emacs) to be your editor, replace pico with the name of your preferred editor. HISTSIZE determines how many of your previous commands are retained for recalling. The line with PAGER determines the pager to use for reading through documents one page at a time. The line with LESS makes it so informative keystroke prompts are put at the of the screen when using the less pager. LPDES determines which printer queue your print jobs submitted with the lp command go to. This line is changed by the 'printers' program, so try not to radically alter this line. You can manually change the queue name here if you want to. ****************************************************************************** export HOST=`hostname` export GROUPNAME=`groups -p $LOGNAME` EDITOR=pico;export EDITOR HISTSIZE=200;export HISTSIZE PAGERless;export PAGER LESS='-c -P spacebar\:page ahead b\:page back /\:search ahead \?\:search back h\:help q\:quit';export LESS LPDEST=laser_q2;export LPDEST ***************************************************************************** Treat unset parameters as an error when substituting. Don't mess with this unless you're a guru. ***************************************************************************** set +u ***************************************************************************** Make it so your terminal is not open to talk requests and placement of comments on your screen by other users. Change this line to 'mesg y' if you want to be open to talk requests by . Otherwise, you can type 'mesg y' within a session to temporarily open yourself for talk requests. ***************************************************************************** mesg n ***************************************************************************** Set up shell for vi-style command line editing (i.e. recalling commands with ESC-k, and using vi editor keystrokes to edit command lines).) If you prefer, you can replace 'vi' with 'emacs' for emacs-style command line editing (i.e. recalling commands with control-P, and using emacs editor keystrokes to edit the command line. ***************************************************************************** set -o vi ***************************************************************************** Define user prompt to show hostname and current directory. This can be changed to anything. Change it to PS1 = 'GET TO WORK, BOZO!! ' if you want the command prompt to repeatedly insult you. ***************************************************************************** PS1='cwis:$PWD $ ' **************************************************************************** Create custom commands. All can be removed/altered *except* 'printers. Feel free to create your own custom commands. The command 'printers' is necessary for the proper functioning of the cwis printer-choosing utility. The 'printers' program changes the line that sets printer queue in this file, and this file gets "runagain to load the new value into the user environment. The command 'more' is altered to call the more capable 'less' pager. Disable this alias if you want to use the 'more' pager. The command 'ls' is set up to identify executable files with an * and directories with a /. Remove this alias if you want the ls command to behave normally, i.e. without the * and /. The command 'edit' is set up to call editor (see EDITOR=... above). The command 'oldmenu' brings up the old cwis menus. The command 'logout' calls the unix command 'exit' to log out. The command 'webperms' sets up file permissions to be world-readable, for web publishing. The command 'regperms' returns file permissions to readable by user only. **************************************************************************** alias printers/share/gen/bin/printers;. $HOME/.shrcalias morelessalias lsls -Falias dirls -Falias edit$EDITORalias oldmenu. /usr/local/bin/cwis2alias logoutexitalias quitexitalias byeexitalias logexitalias webpermsumask 022;chmod -R a+r $HOME/public_htmlalias regpermsumask 077
|
hop jewelry hip hop bling bling jewelry iced out jewelry
Bhopal news
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101