(question) fast split/join of strings

2024-09-16 Thread William Park
Hi all, Is there fast way of splitting and joining of strings in the recent Bash versions? For splitting, I'm aware of old="a,b,c" IFS=, read -a arr <<< "$old" For joining, new=$(IFS=,; echo "${arr[*]}") or new=$(IFS=,; echo "$*")

Re: Feature Request: Python-like string split and join

2021-01-23 Thread William Park
On Sun, Jan 24, 2021 at 11:29:46AM +0800, Koichi Murase wrote: > 2021年1月24日(日) 10:22 William Park : > Is there a background for choosing a semicolon to split words? Zsh has > a similar feature with a different syntax: I'm running out of special characters, and I don't want

Feature Request: Python-like string split and join

2021-01-23 Thread William Park
Eg. echo "${*;.}" would be equivalent to (IFS=.; echo "$*") Where it would be used? - everywhere Advantage? - replaces multiple lines in shell function - makes Bash script simpler and clearer - less bookkeeping and less mistakes -- William Park

Re: Feature Request: scanf-like parsing

2021-01-22 Thread William Park
ort seems perfectly adequate > to me, and it can handle everything that scanf can. I'd only suggest > extending the regular expression syntax with support for named subgroups. Ah.. I forgot Bash now has regex. Just tried =~, and I can get the subgroups out. Request withdrawn. :-) -- William Park

Feature Request: scanf-like parsing

2021-01-21 Thread William Park
everywhere. Advantage: - You can concentrate on "business logic", and less time on bookkeeping. -- William Park

Feature Request: C struct-like template

2021-01-14 Thread William Park
"ver", next 10 arguments into array "rev", ... Then, I just use variable "rev" and that would be equivalent to ${@:55:10}. Where it would useful? - parsing real-life CSV files - parsing UDP packets, for prototyping. - parsing anything that has fixed width format. - ... -- William Park

declare -p name=value thinks 'name=value' is variable

2021-01-08 Thread William Park
Another issue I came across. declare -p name=value thinks 'name=value' is the variable. My reading of manpage seems to say 'name' should be used, but not sure. Is this a bug? Workaround is, of course, use separate lines, declare name=value declare -p name -- William Park

local -p var prints nothing

2021-01-08 Thread William Park
l a=123 declare -p a } f1 # prints nothing f2 # prints $a -- William Park

Feature Request: stack

2020-12-28 Thread William Park
I have feature request: stack variable. Almost like current DIRSTACK with 'pushd' and 'popd', but for regular arrays. I know it can be implemented with array, where you push and pop from the end. But, a real stack is better. -- William Park

BASH_ARGV -- arguments are reversed

2014-11-27 Thread William Park
Hi all, I just noticed that BASH_ARGV contains commandline arguments in reverse. $ cat > x.sh #!/bin/sh declare -p BASH_ARGV ^D $ sh x.sh 1 2 3 4 5 declare -a BASH_ARGV='([0]="5" [1]="4" [2]="3" [3]="2" [4]="1")' -- William

Re: Bug/limitation in 'time'

2013-03-16 Thread William Park
On Sat, Mar 16, 2013 at 10:15:50PM -0400, Chris F.A. Johnson wrote: > On Sun, 17 Mar 2013, Chris Down wrote: > > ExprCount() { > > for (( i = $1 ; i > 0 ; i-- )); do > > : > > done > > echo "$1 iterations" > > } > >Or, in a POSIX-compliant manner: > > ExprCount

Re: Encrypted bashrc?

2011-11-11 Thread William Park
On Fri, Nov 11, 2011 at 04:35:32PM +0800, Clark J. Wang wrote: > On Fri, Nov 11, 2011 at 2:25 PM, William Park wrote: > > > On Fri, Nov 11, 2011 at 01:48:59PM +0800, Clark J. Wang wrote: > > > In my company all the people share a few of Solaris servers which use > > &g

Re: Encrypted bashrc?

2011-11-10 Thread William Park
On Fri, Nov 11, 2011 at 01:48:59PM +0800, Clark J. Wang wrote: > In my company all the people share a few of Solaris servers which use > NIS to manage user accounts. The bad thing is that some servers' root > passwords are well known so anybody can easily su to my account to > access my files. To

Re: Bug fix for $((x**y)) algorithm on 64+ bits machines.

2011-09-18 Thread William Park
No.  For example, current Bash is copyrighted and licensed by the copyright holder. To get included in Bash, though, I think the license should be the same as Bash, at the least. -- William - Original Message - > From: Nicolas ARGYROU > To: Dave Rutherford > Cc: bashbug > Sent: Sa

Re: Bug fix for $((x**y)) algorithm on 64+ bits machines.

2011-09-16 Thread William Park
145557834293068928043467566190278008218249525830565939618481 is awfully big number! :-) -- William - Original Message - > From: Nicolas ARGYROU > To: "bug-bash@gnu.org" > Cc: > Sent: Friday, September 16, 2011 4:39:41 PM > Subject: Bug fix for $((x**y)) algorithm on 64+ bits machines

Re: Why `echo -n hello | while read v; do echo $v; done' prints nothing?

2010-12-02 Thread William Park
On Thu, Dec 02, 2010 at 11:33:24AM -0500, Greg Wooledge wrote: > On Thu, Dec 02, 2010 at 09:29:29AM -0700, Eric Blake wrote: > > On 12/02/2010 04:04 AM, Clark J. Wang wrote: > > > Following command also prints nothing, confused :( > > > > > > for ((i = 0; i < 10; ++i)); do echo -n " $i"; done | wh

Re: Help with sed

2010-04-17 Thread William Park
On Fri, Apr 16, 2010 at 01:22:24AM -0700, Radim wrote: > > Hello, > I have such script: > > (ONLY THIS THREE LINES ARE THE COMMANDS ) > content=$(cat $script | sed '/function codecs/,/fi;/d'); > content=$(echo $content | sed -n '/mandriva/,/fi;}/p'); > content=$(echo $content | sed '/^\s*urpmi[

Re: bash 4.x filters out environmental variables containing a dot in the name

2009-06-28 Thread William Park
Thanks for heads up, Christian. Filtering out "." will break our company's accounting software, and presumably many other applications. Checking for correct charset is sensible thing to do when setting or accessing a variable. But, those variables that Bash did not change or set, should be p

Re: Bash - various feature requests

2006-12-29 Thread William Park
y 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 <

Re: feature request

2006-06-05 Thread William Park
On Wed, May 31, 2006 at 04:49:36PM -0500, A P Garcia wrote: > It would be very useful to have a shell option that displays the exit > code of each command when it terminates. I'm currently using PS1='$? [EMAIL PROTECTED]:\w\$ ' $? is what you are after. -- William P

Re: make 'tr' (or something like it) a bash builtin ?

2006-02-05 Thread William Park
o ${foo^} ## Convert first character > Bar > $ echo ${foo^^} ## Convert all characters > BAR > $ echo ${foo^[a-m]} ## Convert first character that matches pattern > Bar > $ echo ${foo^^[a-m]} ## Convert all characters that match pattern > BAr I did that, and subseq

Re: incorrect brace expansion

2006-01-29 Thread William Park
On Sun, Jan 29, 2006 at 08:16:40PM -0500, Mike Frysinger wrote: > On Sunday 29 January 2006 20:08, William Park wrote: > > On Sun, Jan 29, 2006 at 07:33:14PM -0500, Chris F.A. Johnson wrote: > > > On Sun, 29 Jan 2006, William Park wrote: > > > >Let's see... >

Re: incorrect brace expansion

2006-01-29 Thread William Park
On Sun, Jan 29, 2006 at 07:35:32PM -0500, Mike Frysinger wrote: > On Sunday 29 January 2006 19:23, William Park wrote: > > Let's see... > > a-{b{d,e}}-c > > a-{bd,be}-c > > i'm pretty sure the commas are consumed in the expansion > > side note,

Re: incorrect brace expansion

2006-01-29 Thread William Park
On Sun, Jan 29, 2006 at 07:33:14PM -0500, Chris F.A. Johnson wrote: > On Sun, 29 Jan 2006, William Park wrote: > >Let's see... > > a-{b{d,e}}-c > > a-{bd,be}-c > > a-bd-c a-be-c > > > >It looks okey, I think. > > Except that

{-2..2}

2006-01-29 Thread William Park
f {a..b}? This is the only conflict between your standard Bash and my extensions. If you're keeping it, then I'll change syntax on my end. -- William Park <[EMAIL PROTECTED]>, Toronto, Canada ThinFlash: Linux thin-client on USB key (flash) drive http://home.eol.ca/~parkw

Re: incorrect brace expansion

2006-01-29 Thread William Park
snt > really matter imo > > as you pointed out, the docs say that the brace expansion should only > happen when commas or sequence expressions are used, and while the > inner braces used commads, the outer braces did not -mike Let's see... a-{b{d,e}}-c a-{bd,be}-c

Re: arithmetic operations

2006-01-24 Thread William Park
> 1) > let a=(a+500)/1000 > does not work after update from 3.0 to 3.1, while > let a=\(a+500\)/1000 > is working You should quote that expression, like let 'a=...' > > 2) > a=8000; a=$[(a+500)/1000]; ---> 9 Shouldn't that be $((...)) ? > a=800

Re: Visual completion ellipsis

2005-12-10 Thread William Park
mation about the process of submitting patches, no real > hint of what somebody would have to do to contribute one... Bash and Readline are written by Chet Ramey. So, give the guy a break. He's too busy fixing bugs. :-) -- William Park <[EMAIL PROTECTED]>, Toronto, Canada ThinF

Re: weird bash and vfat behaviour

2005-12-05 Thread William Park
nd COMp4015, but when it's all capitals, it > displays it as lowercase. It displays fine on my windows box... Is > this a bash problem? Is it something else altogether? It is 'vfat' issue. Try few mounting options. man mount. -- William Park <[EMAIL PROTECTED]>, Toron

Re: Bug in Bash-3.00

2005-11-15 Thread William Park
of code), but, > if you prefer so, then you can download it directly > from any slackware mirror (for instance, > from > > http://slackware.ngi.it/slackware-10.2/source/a/bash/patches/ > ). -- William Park <[EMAIL PROTECTED]>, Toronto, Canada ThinFlash: Linux thin-client on U

Re: reciproc pipe()

2005-09-04 Thread William Park
, each process communicates with the other via stdin/stdout, and we get the > actual results via stderr. Where would you use it? -- William Park <[EMAIL PROTECTED]>, Toronto, Canada ThinFlash: Linux thin-client on USB key (flash) drive http://home.eol

Re: IFS=$'\xb2'

2005-08-06 Thread William Park
5b/3.0, and I don't get segfault. -- 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/ __

Re: jobs not working in bash scripts (?)

2005-07-22 Thread William Park
gt; shell. > > I know it worked before in that script and ksh does not make a difference > between interactive and non-interactive shell. But I don't know > > Any comments are welcome. See if set -m makes any difference. -- William Park <[EMAIL PROTECTED]>, Toront

Re: (announce) GTK+2 + Bash

2005-07-13 Thread William Park
On Mon, Jul 11, 2005 at 11:57:38AM -0400, William Park wrote: > Ref: > http://freshmeat.net/projects/bashdiff/ > http://home.eol.ca/~parkw/index.html#gtk More updates. The documentation now has some snapshots. The latest release is BashDiff-1.24. -- William Park <[EMA

(announce) GTK+2 + Bash

2005-07-11 Thread William Park
ow build the same thing with Or, gtk << EOF ... EOF Feedbacks are welcome. Enjoy! -- William Park <[EMAIL PROTECTED]>, Toronto, Canada ThinFlash: Linux thin-client on USB key (flash)

(submission) patch to 'parse.y'

2005-07-05 Thread William Park
CMD_IGNORE_RETURN; + exec_result = execute_try_command (command->value.Try); + break; + case cm_if: if (ignore_return) command->value.If->flags |= CMD_IGNORE_RETURN; @@ -1578,9 +1593,38 @@ SHELL_VAR *old_value = (SHELL_VAR *)NULL; /* Remember the ol

Re: (feature request) here-document, but from a file

2005-07-03 Thread William Park
On Sat, Jul 02, 2005 at 11:43:36PM -0400, Chet Ramey wrote: > Chris F.A. Johnson wrote: > > On Sat, 2 Jul 2005, William Park wrote: > > > >> Dear Chet, > >> > >> It would be nice if I can read a file and process it as though it was > >> here-do

Re: (feature request) here-document, but from a file

2005-07-02 Thread William Park
On Sat, Jul 02, 2005 at 05:48:40PM -0600, Bob Proulx wrote: > Chris F.A. Johnson wrote: > > William Park wrote: > > >It would be nice if I can read a file and process it as though it was > > >here-document text in the script. Mainly, I want variable substitution, > &

(feature request) here-document, but from a file

2005-07-02 Thread William Park
cat <<+ file cat <<<< file -- 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/ ___

Re: make -j# for parallel build failed

2005-06-30 Thread William Park
_SUPPORT) Makefile + $(RM) pathnames.h maybe-clean: -if test "X$(topdir)" != "X$(BUILD_DIR)" ; then \ -- William Park <[EMAIL PROTECTED]>, Toronto, Canada ThinFlash: Linux thin-client on USB key (flash) drive http://home.eol.ca/~parkw/thinflash.h

LF becomes BACKSLASH LF in 'declare -p'

2005-06-30 Thread William Park
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKA

Re: Update on parent exiting after background command substitution

2005-06-30 Thread William Park
exits. > > This is a classic race condition. It's already been fixed for the > next version. Hi Chet, Can you explain what's happenning with $( : | : ) & -- William Park <[EMAIL PROTECTED]>, Toronto, Canada ThinFlash: Linux thin-client on USB key (flash) drive

Updated fix of array_rshift() in array.c

2005-05-31 Thread William Park
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKA

Re: bash script problems

2005-05-11 Thread William Park
eric argument > > I was wondering if BASH requires type conversion? I even printed out > the values for $val1 and $val2. They look like integers to me. If > anyone could help me, it would be greatly appreciated. > > Thanks in advance Note the difference between `...` and

Re: Double-quoting of commandline args (problem if $1 as a string of more than 1 char)

2005-04-02 Thread William Park
t; exit > else > echo $1 > echo $2 > echo $3 > echo $4 > echo $5 > echo $6 > echo $7 > echo $8 > echo $9 > echo "$10" > echo "$11" > echo "$12" > fi Try ${10} -- William Park <[EMAIL PROTECTED]>, Toronto, Canada Slackwar

Re: reading ascii-0

2005-03-08 Thread William Park
t; read x < foo > then > echo ${#x} > always returns 4 instead of 9 or 10 because it stopped after "asdf" at > the null char > > I've played with setting $IFS, and with -r and -d on the read command > itself, but nothing seems to work. > > Is t

Re: Feature semi-request about bash initialization

2005-03-07 Thread William Park
s ~/.xsession which is usually symlink to ~/.xinitrc, but doesn't have to be. Then, you're into your windows manager. This initial file is run like any other shell script on your system. If you're talking about Xterm, then bring it up as xterm -ls -- William Park <[EMA

Re: Problem with sort

2005-02-28 Thread William Park
On Mon, Feb 28, 2005 at 05:28:17PM +0100, Bernd Klein wrote: > Hi, > > I think I found a bug in "sort". > Maybe this list is not the right place to report it, but I don't know > where else to do it. Manpage of 'sort' says, Report bugs to . _

'nocaseglob' does not work in 'case' or '[[...]]'

2005-02-14 Thread William Park
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKA