Subject: 1.400: How do I make an informative prompt in the shell? In the Korn Shell (ksh), the PS1 variable is expanded each time it is printed, so you can use: $ export myhost=`hostname` $ PS1='$LOGNAME@$myhost $PWD \$ ' to get, e.g. bengsig@ieibm1 /u/bengsig $ In the C-shell, use: % set myhost=`hostname` % alias cd 'chdir \!* > /dev/null; set prompt="$LOGNAME@$myhost $cwd % "' % cd to get, e.g. bengsig@dkunix9 /u/bengsig/aixfaq % There is no easy solution in the Bourne Shell. Use the Korn Shell instead. ------------------------------ Subject: 1.401: How do I set up ksh for emacs mode command line editing? The ksh has an undocumented way of binding the arrowkeys to the emacs line editing commands. In your .kshrc, add: alias __A=`echo "\020"` # up arrow = ^p = back a command alias __B=`echo "\016"` # down arrow = ^n = down a command alias __C=`echo "\006"` # right arrow = ^f = forward a character alias __D=`echo "\002"` # left arrow = ^b = back a character alias __H=`echo "\001"` # home = ^a = start of line Type "set -o emacs" or put this line in your .profile. Also, you MUST have PTF U406855 for this to work in AIX 3.2. The APAR # for the problem is IX25982, which may have been superseded. ------------------------------ Subject: 1.402: Listing files with ls causes a core dump From: Julianne F. Haugh Scenario: a directory that is shared by N users (N >= 200). Run 'ls -l' in that directory. It goes for a while, then Seg fault(coredump)! It only occurs when the usernames are displayed (almost every file is owned by a different person). The -g and -n options work fine; only -l and -o (which shows owner and not group) cause it. I believe that this problem was corrected by U407548. If you have that many users that you are having core dump problems (it took over 200), you might also want to look into getting the PTF that fixes IX31403. That APAR deals with large numbers of accounts and performance problems associated with looking them up. ------------------------------ Subject: 1.403: How do I put my own text into InfoExplorer? With AIX 3.1, you cannot do it. AIX 3.2 has a product called InfoCrafter that allows you to do that. ------------------------------ Subject: 1.404: InfoExplorer ASCII key bindings From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum) If you just press 'Return' when it starts up, with 'Basic Screen Operations' highlighted, you'll get some help. If you look long enough, you'll find a page named 'Using Keys and Key Sequences in the InfoExplorer ASCII Interface'. It describes the key sequences and actions. Here are a few to get you started. Keys Action Ctrl-W Moves between the Navigation screen and the Reading screen. If the Navigation screen is displayed, you can press Ctrl-W to display the Reading screen. If the Reading screen is displayed, you can press Ctrl-W to display the Navigation screen. Ctrl-O Makes the menu bar active or inactive. If your text cursor is located in the text area of the screen, you can press Ctrl-O to make the menu bar active. If the menu bar is already active, you can press Ctrl-O to make it inactive, which moves the text cursor to the text area. Tab Moves to the next menu bar option in the menu bar. If a pull-down menu is not displayed and you press the Right Arrow key, the next menu bar option is displayed in reverse video. ------------------------------ Subject: 1.405: How can I add new man pages to the system? From: horst@faui63.informatik.uni-erlangen.de (Horst Luehrsen) Put the man pages in /usr/man, e.g. /usr/man/man1/tcsh.1 for the tcsh man page. Under AIX 3.1.10, /usr/lib/makewhatis can be used to update the makewhatis-database /usr/man/whatis so apropos and whatis know about the added manpages. /usr/lib/makewhatis should be available on all 3.2 versions. For AIX 4.x, you can store the man pages in the /usr/share/man hierarchy. /usr/lib/makewhatis is still there. ------------------------------ Subject: 1.406: Why can't I read man pages? Where is nroff? Nroff and troff aren't in the base installation. It is shipped as part of AIX 3.2.5 but may not be installed. Use smit to install a software package called txtfmt.tfs.obj from your 3.2.5 distribution media. In AIX 4.x, you need bos.txt.tfs. ------------------------------ Subject: 1.407: Why is my environment only loaded once? The .profile file is only loaded once (for your login shell) subsequent shells should be initialized by setting ENV=$HOME/.kshrc (for ksh). Bash users can use $HOME/.bash_profile for the login shell environment and $HOME/.bashrc. ------------------------------ Subject: 1.408: Where is the 'nawk' command on my AIX system? From: Jeff Wang The /bin/nawk that exists on many UNIX flavors is a superset of the 'awk' command, revised by the same original authors to include added functionality. All the extra options normally associated with 'nawk' on other UNIXes have been incorporated into the AIX version of 'awk'; the AIX 'awk' InfoExplorer or man pages include nawk-specific features such as the "-v" command line option and atan2(), rand(), srand(), match(), sub(), gsub(), system(), close(), getline functions. If your AIX version is missing /bin/nawk (as are most AIX 3.x versions), the simplest way to get around this and maintain script portability between UNIX platforms is to make a /bin/nawk link to /bin/awk (as root, of course). If you do not have root privilege or do not want to create a /bin/nawk link, to make the script work on different UNIXes, you may have to test `uname` first and set all 'nawk' references on AIX runs to /bin/awk. If your script is to only run on AIX systems, you can just change all references of 'nawk' to 'awk' and everything should still work okay...but check the AIX awk script on test data prior to making actual runs. [Editor's note: AIX 4.x already contains a link from /usr/bin/nawk to /usr/bin/awk.] ------------------------------ Subject: 1.409: How do I copy InfoExplorer (manpages and more) to my hard drive? From: David Alexander [Editor's note: While this is documented in one of the AIX manuals and covered in /usr/lpp/bos/bsdadm (AIX 3 only), it comes up often enough I thought I would include it here.] Not all the Info databases are required, so do not copy them all unless the customer specifically requests them, or has asked for the software they refer to. These instructions assume you have enough space on /usr. Install and mount the InfoExplorer CD-ROM as for use of Info from CD-ROM. Log in as Root umount /usr/lpp/info/lib/$LANG mkdir /mnt/$LANG mount -v cdrfs -r /dev/cd0 /mnt/$LANG cd / cd /mnt/$LANG cp -r aix /usr/lpp/info/lib/$LANG cp -r aix2 /usr/lpp/info/lib/$LANG cp -r compnav /usr/lpp/info/lib/$LANG cp -r hardware /usr/lpp/info/lib/$LANG cp -r nav /usr/lpp/info/lib/$LANG cp -r prog /usr/lpp/info/lib/$LANG cp -r uiprog /usr/lpp/info/lib/$LANG Other sections can be copied if required: Section Size cp -r ada /usr/lpp/info/lib/$LANG 7.2 Mb cp -r assemb /usr/lpp/info/lib/$LANG 5.23 Mb cp -r cxx /usr/lpp/info/lib/$LANG 6.52 Mb cp -r dce /usr/lpp/info/lib/$LANG 3.8 Mb cp -r encina /usr/lpp/info/lib/$LANG 2.67 Mb cp -r fortran /usr/lpp/info/lib/$LANG 6.85 Mb cp -r graph /usr/lpp/info/lib/$LANG 9.75 Mb cp -r graph2 /usr/lpp/info/lib/$LANG 4.1 Mb cp -r pascal /usr/lpp/info/lib/$LANG 3.23 Mb umount /mnt/$LANG eject the CD-ROM ------------------------------ Subject: 1.410: Why can't I set my default shell to one we've just installed? When adding new shells to the system, add them to the "shells=" line in /etc/security/login.cfg so they can be used during ftp and rlogin by users who use them as their default shell. ------------------------------ Subject: 1.411: Why do I get the "Unable to connect socket: 3" starting Info-Explorer? It's a bug in the way infod sets the initial permission on the /tmp/.info-help socket. Do a chmod 777 on /tmp/.info-help and the message will go away. (Charlie McGuire, mcguire@cs.umt.edu) This problem was fixed by APAR IX43230, PTF U432315 (Paul Sitz, psitz@empros.com) ------------------------------ Subject: 1.412: Why can't I write a setuid shell script? From: mww@microfocus.com (Michael Wojcik) AIX, as of about the first release of 3.2.5* does not allow SUID scripts. (It ignores the SUID and SGID bits on scripts.) They're a huge security hole. If you really want to run a script SUID, you can create a small C program that does a setuid(0) and then system()'s your script. (Actually, the setuid() call isn't necessary on all Unixes; IIRC, it's not on AIX 3.2.5, but YYMV.) Make the program SUID. Be very careful. There are other similar solutions. You might also want to look into sudo, which handles this sort of thing in a somewhat more controlled manner * Julianne Frances Haugh (jfh@tab.com) writes: I raised an objection to set-ID shell scripts before AIX 3.1 was golden. ... it was finally done in the 3009 PTF for AIX 3.1. ------------------------------