On Wed, Dec 27, 2006 at 11:03:31PM +0000, Richard Neill wrote: > 1)substr support for a negative length argument. > For example, > stringZ=abcdef > echo ${stringZ:2:-1} #prints cde > > i.e. ${string:x:y} > returns the string, from start position x for y characters. > but, if x is negative, start from the right hand side > and if y is negative, print up to the end, -y. > > This would work the same way as PHP, and be extremely useful for, say, > removing an extension from a filename. > http://uk.php.net/manual/en/function.substr.php
Python has it too :-) > 5)An enhancement to read/readline, such that one can specify the initial > value with which the buffer is filled. > > Currently, we can do: > > read -ep 'Enter your name: ' NAME > > and I might type "Richad Neill". #Note the deliberate typo. > > If the script recognises this as invalid, the best it can do is: > > echo "Name not recognised" > read -ep 'Re-enter your name: ' NAME > > and the user must retype it in full. > I'd like to propose adding an "-i" option for initial value: > > echo "Name not recognised" > read -ep "Please correct your name: " -i "$NAME" > > The shell prints: > Please correct your name: Richad Neill > where the latter part is now editable. > > Thus the really nice editing features of readline can be used for > updating values already stored in variables. This is extremely useful > when the value is quite long. Is this the same as read -ep "Please correct your name: $NAME" NAME ? -- William Park <[EMAIL PROTECTED]>, Toronto, Canada ThinFlash: Linux thin-client on USB key (flash) drive http://home.eol.ca/~parkw/thinflash.html BashDiff: Super Bash shell http://freshmeat.net/projects/bashdiff/ _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash