new patch for Bash-3.0

William Park opengeometry-FFYn/CNdgSA at public.gmane.org
Thu Aug 5 21:59:23 UTC 2004


Hi all,

While I was away, Bash-3.0 was released.  My shell patch is now against
Bash-3.0.  Ref:
    http://freshmeat.net/projects/bashdiff/
    http://home.eol.ca/~parkw/index.html#bash
    help ...

Highlights are
    - integer/character generator (from Zsh)
    - list comprehension, content filtering (from Python)
    - try-block and exception (from Python)
    - string operation (from Chris)
    - extended for/while/until loops to handle exit condition (from
      Python)
    - extended case for regex(3), continuation (Ksh/Zsh), exit condition
      (Python)
    - simple GDBM/SQLite/MySQL/PostgreSQL interface.
    - sscanf(3) wrapper
    - multiple for-loop variables

Summary of some syntax:

    {a..b} {a--b} {**} {##} {^var}

    ${var|command}
    ${var|+n}       -- skip every n'th item
    ${var|++n}      -- repeat until all items are selected
    ${var|^}        -- convert first char to uppercase
    ${var|^^}       -- convert all chars to uppercase
    ${var|^pat}     -- convert first char, if member of pattern
    ${var|^^pat}    -- convert all chars, if member of pattern
    ${var|_}        -- convert first char to lowercase
    ${var|__}       -- convert all chars to lowercase
    ${var|_pat}     -- convert first char, if member of pattern
    ${var|__pat}    -- convert all chars, if member of pattern
    ${var|~}        -- toggle first char
    ${var|~~}       -- toggle all chars
    ${var|~pat}     -- convert first char, if member of pattern
    ${var|~~pat}    -- convert all chars, if member of pattern
    ${var|>n}       -- shift right n char, pad with space
    ${var|>>n}      -- rotate right n char
    ${var|<n}       -- shift left n char, pad with space
    ${var|<<n}      -- rotate left n char

    var+=value	    -- string concatenation
    var[i]+=value
    var[+]=value    -- array append

    case WORD in
	glob) ...  [;; | ;& | ;;&]
	regex)) ...  [;; | ;& | ;;&]
    esac [then COMMANDS; else COMMANDS; fi]

    for NAME [in WORDS...;] do COMMANDS; done [then COMMANDS; else COMMANDS; fi]

    while COMMANDS; do COMMANDS; done [then COMMANDS; else COMMANDS; fi]

    until COMMANDS; do COMMANDS; done [then COMMANDS; else COMMANDS; fi]

    try COMMANDS; done [ in
	NUMBER [| NUMBER]... ) COMMANDS ;;
    esac ]

    sscanf input format var1 [... var9]
    match string regex [submatch]

    gdbm [-euikv] [-KVW array] file [key | key value ...]
    sql [-a array] -d file SQL...
    Psql [-a array] [-h host -p port -d dbname -u user -P password ] SQL...
    Msql [-a array] [-h host -p port -d dbname -u user -P password ] SQL...

-- 
William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>
Open Geometry Consulting, Toronto, Canada
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list