Tag Info

New answers tagged

0

I use these in mkshfor a user shell: # custom prompt see http://comments.gmane.org/gmane.os.miros.mksh/126 PS1=$'\a\r\a\e[1;34m\a ^ ^ ^ ^ | \a\e[36m\a${USER:=$(ulimit -c 0; id -un 2>/dev/null || echo \?)}@${HOSTNAME%%.*}\a\e[34m\a | ^ ^ ^ ^ | \a\e[0;33m\a$(local d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || d=${d/#$p/~}; print -nr -- "$d")\a\e[1;34m\a |\n ^ ^ ...


3

For ksh93, you have (at least) a couple of choices associative arrays envir=Dev foo["$envir"]=bar echo "${foo["$envir"]}" namerefs nameref var=${envir}foo var=bar echo "$var" For ksh88, you may be stuck with eval: envir=Dev name="${envir}foo" eval "$name=bar" eval "echo \$$name"


0

Here are two alternatives, depending on your end goal. Only show the trailing directory element PS1='^[]0;${USER}@${HOST}: ${PWD##*/}^Gksh$ ' This simply introduces the ## parameter substitution to your existing PS1 in order to greedily strip away characters until the final forward slash. This will shorten the PWD portion of the PS1 prompt string ...


1

Piping an input file into a read command is generally a recipe for disaster, it can work in some circumstances, but in many cases it does not. Best to learn a more consistent way of doing this. Here are a couple of simple alternatives... nawk '{print $1}' $( cat input.txt ) > output.txt or if you want it in a loop... for FILENAME in $( cat input.txt ...


1

I'm not sure which version of System V you're using, nor which version of ksh, but it's possible to change the completion key to Tab with ksh93 (not with ksh88, though, I believe). Depending on age, these in your ~/.profile may do it: set -o emacs bind bind "^I=complete" See this thread for more info.


0

To be more clear consider cat <<EOF foo bar $baz EOF fubar="Hello World" cat <<EOF echo $fubar print \$fubar EOF when run will give foo bar echo Hello World print $fubar on first cat you'll notice that $baz variable disappear (provided it is not set). on second run, I set fubar variable, it is echoed with it's value, to echo ...


3

Even though ksh has more advanced feature than other shells, it's still at its heart a language to automate simple task and write small scripts, not a language geared towards writing huge applications. You can't expect to have all the features of a typical language designed for large applications, let alone all the features of C++. I don't think you can ...



Top 50 recent answers are included