From: Scott Bass on 10 Feb 2010 19:51 Sorry this is getting long winded, please see below... On Feb 11, 10:47 am, Sven Mascheck <masch...(a)email.invalid> wrote: > Scott Bass wrote: > >> > Version 11/16/88 > > >> Early ksh is not verbose enough here. The HP-UX "ksh" is a ksh88c. > >> Instead, why not use "sh" (/bin, /sbin, etc.), a ksh88f? > > > [...] I think the sysadmin is afraid to change anything. > > If you mean installing packages: /bin/sh is onboard and it's not a > Bourne shell, but a more recent ksh on HP-UX. If you mean even > changing your login shell is not an option: just "exec sh". Hmmm, I knew sh was installed, but I though sh=Bourne shell and ksh=Korn shell and never the twain shall meet. Bizarre that /usr/bin/ sh=Korn shell on HP-UX. On Solaris, for different versions of software, you'd usually see something like: /usr/bin/ksh88 (executables) /usr/bin/ksh93 /usr/bin/ksh -> /usr/bin/ksh93 (symlink) On my system, exec sh then Cntl-V returns: Version M-11/16/88f Questions: 1) Are you aware of a document anywhere that lists the differences between Version 11/16/88 and Version M-11/16/88f? (I did check out your website - do I gain anything short of the listed bug fixes?) 2) In my PuTTY configuration, SSH tab, remote command, I tried "exec sh" and "exec sh -". Both brought up the terminal, but the .profile and .kshrc are not sourced? Any idea what I would put in the PuTTY configuration to automatically switch to using /usr/bin/sh (short of changing /etc/passwd). 3) From your website, I saw that /usr/dt/bin/dtksh: M-dtksh93d. I tried "/usr/dt/bin/dtksh" and "exec /usr/dt/bin/dtksh". I thought ksh93 mapped filename completion to TAB in addtion to ESC ESC (who dreamed that key sequence up???). But TAB didn't work. > >> > mycd[2]: @: parameter not set > > >> This looks like you have a "set -u" somewhere. > > If this becomes relevant elsewhere: confirm with "echo $-", > it would contain a "u". Revert with "set +u" if it's global. Yes, "echo $-" yields "isuam", but "man set" yields "Modifies characteristics for the DTS entity." I can probably Google for a man page for the set command (builtin?) but a one-liner of what set -u vs. set +u does would be useful.
From: Janis Papanagnou on 10 Feb 2010 20:05 Scott Bass wrote: > Sorry this is getting long winded, please see below... > > On Feb 11, 10:47 am, Sven Mascheck <masch...(a)email.invalid> wrote: >> Scott Bass wrote: >>>>> Version 11/16/88 >>>> Early ksh is not verbose enough here. The HP-UX "ksh" is a ksh88c. >>>> Instead, why not use "sh" (/bin, /sbin, etc.), a ksh88f? >>> [...] I think the sysadmin is afraid to change anything. >> If you mean installing packages: /bin/sh is onboard and it's not a >> Bourne shell, but a more recent ksh on HP-UX. If you mean even >> changing your login shell is not an option: just "exec sh". > > Hmmm, I knew sh was installed, but I though sh=Bourne shell and > ksh=Korn shell and never the twain shall meet. Bizarre that /usr/bin/ > sh=Korn shell on HP-UX. Quite common that there's another shell than Bourne shell behind 'sh'; on AIX it was a ksh as well (AFAIR), and on Linux systems it's a bash. On modern system it's likely any POSIX compatible shell. Janis > > [...]
From: Seebs on 10 Feb 2010 21:00 On 2010-02-10, Scott Bass <sas_l_739(a)yahoo.com.au> wrote: > Hi Ed and Sven, > > Thanks heaps for your replies. Much appreciated. I've got it working > now. Here is my final code: I hope not, because I'm about to suggest an improvement. :) > PROMPT="$FG_GRAY$BG_RED$(logname)@$(hostname):\${PWD}$NC > " > PS1=$(print -n $PROMPT) Why are you setting this more than once? Why not just, in .profile: PS1="$FG_GRAY$BG_RED$(logname)@$(hostname)\${PWD}\$NC > " So far as I know, ksh expands variables in PS1 when printing it, so you don't have to touch PS1 when you cd. BTW, while we're talking about PS1: Put $? in PS1. I did this a few years back, and WOW has it been useful. It turns out that exit status is often very informative, and not always clearly displayed. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Seebs on 10 Feb 2010 21:01 On 2010-02-11, Janis Papanagnou <janis_papanagnou(a)hotmail.com> wrote: > Quite common that there's another shell than Bourne shell behind 'sh'; > on AIX it was a ksh as well (AFAIR), and on Linux systems it's a bash. Except Debian/Ubuntu have switched to dash (a slightly tweaked ash). Big performance win, apparently. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Scott Bass on 11 Feb 2010 00:45
On Feb 11, 1:00 pm, Seebs <usenet-nos...(a)seebs.net> wrote: > > PROMPT="$FG_GRAY$BG_RED$(logname)@$(hostname):\${PWD}$NC > " > > PS1=$(print -n $PROMPT) > > Why are you setting this more than once? Why not just, in .profile: > > PS1="$FG_GRAY$BG_RED$(logname)@$(hostname)\${PWD}\$NC > " > > So far as I know, ksh expands variables in PS1 when printing it, so you > don't have to touch PS1 when you cd. > > BTW, while we're talking about PS1: > > Put $? in PS1. I did this a few years back, and WOW has it been useful.. > It turns out that exit status is often very informative, and not always > clearly displayed. Thanks Seebs, you're right. As I understand it: ..profile is sourced by a login shell, i.e. interactive session ..kshrc is sourced by ksh, such as a ksh script (this includes an interactive session) (Actually it looks like .kshrc is sourced by /usr/local/adm/kshrc) In summary, my files look like: ..profile: export DISPLAY=[local PC IP address]:0.0 set -o emacs stty erase "^H" if "$TERM" = "xterm" # vt100 normal (non-application) cursor keys alias -x __A=$(print '\020') # Set the up arrow to Ctrl-P (previous command) alias -x __B=$(print '\016') # Set the down arrow to Ctrl-N (next command) alias -x __B0=$(print '\017') # Trust me on this one you just need it alias -x __C=$(print '\006') # Set the right arrow to Ctrl-F (move forward) alias -x __D=$(print '\002') # Set the left arrow to Ctrl-B (move backwards) # Home and End for typical vt100 emulations # (this doesn't work, I can't find the key codes for Home and End. Oh well...) <<<<<<<<<<<< alias -x __F=$(print '\001') # Set the home key to Ctrl-A (start of command) alias -x __K=$(print '\005') # Set the end key to Ctrl-E (end of command) # set custom prompt # need to use print command (or echo) to resolve the escape codes # need to escape $PWD to delay variable resolution until "run time" PROMPT="\$?:$FG_GRAY$BG_RED\$?:$(logname)@$(hostname):\${PWD}$NC > " PS1=$(print -n $PROMPT) # Define custom cd function to set window title # Need to use a function due to use of basename command mycd() { # Change directory (backslash calls shell builtin preventing infinite recursion) \cd "${@:-$HOME}" # full path (but gets truncated in Windows icon if path is long) # WINDOW_TITLE="\033]0;$PWD\007" # basename (last token in path) WINDOW_TITLE="\033]0;$(basename $PWD)\007" # Set Window Title print -n "$WINDOW_TITLE" } # alias cd to my custom function alias -x cd="mycd" All of this only applies to an interactive session so should be in .profile. ..kshrc set -o emacs # needs to also be in .kshrc for the arrow key aliases to work, i don't know why Various aliases that might be used in a script (most were set by my sysadmin) Augment $PATH |