Re: Are there any plans for more readable, modern syntaxes for If statements?

2020-03-26 Thread Allodoxaphobia
On Thu, 26 Mar 2020 19:05:58 +0200, Vaidas BoQsc wrote:
> I keep on wondering why these shells can't come up with something better
> than improving previous shell syntax by little by only providing poor
> better alternatives.
> I somehow think there is a need to rethink shells from scratch to make them
> less mentally demanding and readable in the command prompt and scripts
> themselves.
> I really haven't seen anything that I would like to use so far. Neither
> zsh, tcsh or any other of the more popular ones as far as I remember from
> the last weeks "personal research".

You are always welcome to run perl as your shell.
Or, even php !



Re: Important request, participation in software development study

2020-02-04 Thread Allodoxaphobia
On Tue, 4 Feb 2020 11:45:45 -0500 (COT), ivandarioarr...@gmail.com wrote:
> Dear Engineers,
>
> When I write this message, I think I am writing to the best software 
> developers in the world, or to those who are in the process of being 
> one.

It will be interesting to see what other ng's this pops up in -- the 
other ones "with the best software developers in the world..."




Re: Regular Expression matching operation =~

2019-09-23 Thread Allodoxaphobia
On Mon, 23 Sep 2019 09:21:44 -0400, Chet Ramey wrote:
> On 9/22/19 5:44 PM, Allodoxaphobia wrote:
>
>> In moving a bash ver. 4.3.48 (Ubuntu) program to a bash ver. 5.0.11
>> (FreeBSD) environment I encountered either a bug, a quirk, or
>> an undocumented feature.
>
> It's not exactly undocumented, more undefined. You can't count on 
> the NUL character or the empty string doing anything in particular.

Thanks.  The "undocumented" action made it so much easier
for some coding logic in my linux/Ubuntu environement. :-)

Thanks, also, to Grisha Levit for more details about the "why".

Regards,
Jonesy
--
  Marvin L Jones| Marvin  | W3DHJ.net  | linux
   38.238N 104.547W |  @ jonz.net | Jonesy |  FreeBSD
* Killfiling google & banter.com: jonz.net/ng.htm



Regular Expression matching operation =~

2019-09-22 Thread Allodoxaphobia
In moving a bash ver. 4.3.48 (Ubuntu) program to a bash ver. 5.0.11 
(FreeBSD) environment I encountered either a bug, a quirk, or 
an undocumented feature.

I was using a null regexp as a "match for anything" case when an
optional command line parameter (a test pattern) was omitted.

I boiled down what I was experiencing to 

$ bash -version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
$ [[ "String" =~ "ring" ]] ; echo $?
0
$ [[ "String" =~ "" ]] ; echo $?
0
$

$ bash -version
GNU bash, version 5.0.11(0)-release (amd64-portbld-freebsd12.0)
$ [[ "String" =~ "ring" ]] ; echo $?
0
$ [[ "String" =~ "" ]] ; echo $?
2
$

A null regexp works Just Fine in both the Ubuntu and FreeBSD
environments. E.g.:

$ grep "" /etc/shells

Jonesy
-- 
  Marvin L Jones| Marvin  | W3DHJ.net  | linux
   38.238N 104.547W |  @ jonz.net | Jonesy |  FreeBSD
* Killfiling google & banter.com: jonz.net/ng.htm



Re: List out

2016-02-15 Thread Allodoxaphobia
On Mon, 15 Feb 2016 08:19:37 -0500, Greg Wooledge wrote:
> On Sun, Feb 14, 2016 at 03:02:58AM +0000, Allodoxaphobia wrote:
>> err... u... What's your *bash bug* ???
>
> I think what he meant to say is, "Questions of this type should be
> sent to help-b...@gnu.org instead of bug-bash@gnu.org."
>
> Now... you've been given a Python solution, and I could write one in
> Tcl or Perl as well.  Using pure bash for this task would be an utterly
> poor choice, for performance reasons.
>
> The closest thing to a pure bash answer you can get, that would actually
> be viable in real life, would be one using awk.
>
> awk '
>   {
> n=0
> label=$2
> for (i=3; i<=NF; i++) {
>   if ($i == "NA") n++
> }
> print NR ".", label, n
>   }
> ' "$file"

Remeber to _always_ reply to homework assignments with 
the most advanced and obscure solutions so as to make 
the teacher/professor say "WHAT THE HELL...?!?!?!"



Re: List out

2016-02-13 Thread Allodoxaphobia
On Sun, 14 Feb 2016 00:25:46 + (UTC), Val Krem wrote:
> Hi all,
>
> I have a file (5000  rows and 65,000 columns). 
>
>
> 1. For each row I want find and count the number of missing variable 
> represented by (NA) and then print out.
>  
> Sample data
>
> 1. fgh1  1 1 2 1 NA 2 2
>
> 2. fgh21 1 2 1  NA 2 NA
> 3. fgh31 1 2 1  1 2 2 
>
> 4. fgh4  NA NA NA NA NA Na
>
>
> Desired out put
> 1. fgh11 
>
> 2. fgh2  2 
> 3. fgh30 
> 4. fgh4  7
>
> Thank you in advance

err... u... What's your *bash bug* ???



Re: Only one Friday 13th coming in 2016

2015-12-21 Thread Allodoxaphobia
On Sun, 20 Dec 2015 23:59:32 -0500, Bill Duncan wrote:
> We had 3 this year..
>
> $ for y in {1950..2050} ; do for m in {1..12};do cal $m $y|awk 
> 'FNR==1{m=$0}/^ 1/{print m}';done;done| awk '{a[$2]=a[$2]" "$1}END{for (i in 
> a) print i,a[i]}'| sort| awk '{t=$1;$1="";a[$0]=a[$0]" "t}END{for (i in a) 
> printf "%-24s %s\n", i, a[i]}' | sort | cat -n
>
>  1   April July   1951 1962 1973 1979 1990 2001 2007 2018 
> 2029 2035 2046
>  2   August   1954 1965 1971 1982 1993 1999 2010 2021 
> 2027 2038 2049
>  3   February August  1976 2004 2032
>  4   February March November  1953 1959 1970 1981 1987 1998 2009 2015 
> 2026 2037 2043
>  5   January April July   1956 1984 2012 2040
>  6   January October  1950 1961 1967 1978 1989 1995 2006 2017 
> 2023 2034 2045
>  7   June 1952 1958 1969 1975 1980 1986 1997 2003 
> 2008 2014 2025 2031 2036 2042
>  8   March November   1964 1992 2020 2048
>  9   May  1955 1960 1966 1977 1983 1988 1994 2005 
> 2011 2016 2022 2033 2039 2044 2050
> 10   October  1972 2000 2028
> 11   September December   1957 1963 1968 1974 1985 1991 1996 2002 
> 2013 2019 2024 2030 2041 2047
>
>
> Happy Holidays, Happy New Year in 2016 and thanks for being involved with 
> such a great shell!

heh...  The eyes boogle.  :-)
Is the logic exhaustive ? -- in that it shows there 
are no years with *no* Friday The 13Th's?

Holiday Cheer to you, as well!
Jonesy
-- 
  Marvin L Jones| Marvin  | W3DHJ.net  | linux
   38.238N 104.547W |  @ jonz.net | Jonesy |  FreeBSD
* Killfiling google & banter.com: jonz.net/ng.htm



Re: Incomplete 'command not found' error message if command name contains spaces

2015-04-01 Thread Allodoxaphobia
On Tue, 31 Mar 2015 15:39:13 -0500, John McKown wrote:
 Hum, on my system, I get the message you are expecting. Transcript:
 -snip-

And, here...
This is puzzling.
On an older Ubuntu 10.04 system I still use (I know, I know...) I
get _no_ response.  But the return code appears correct:

jonesy@nix4:~$ uname -a
Linux nix4 2.6.32-39-generic #86-Ubuntu SMP Mon Feb 13 21:47:32 UTC 2012 i686 
GNU/Linux
jonesy@nix4:~$ bash -version
GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
http://gnu.org/licenses/gpl.html
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
jonesy@nix4:~$ echo $?
0
jonesy@nix4:~$ a nonexistent command with spaces
jonesy@nix4:~$ echo $?
127
jonesy@nix4:~$

However on my FreeBSD VPS it works as expected:

[jonz~]uname -a
FreeBSD xxx..net 10.1-RELEASE-p6 FreeBSD 10.1-RELEASE-p6 #0: Tue Feb 24 
19:00:21 UTC 2015
[jonz~]bash -version
GNU bash, version 4.3.33(0)-release (amd64-portbld-freebsd10.1)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
http://gnu.org/licenses/gpl.html
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[jonz~]echo $?
0
[jonz~]a nonexistent command with spaces
-bash: a nonexistent command with spaces: command not found
[jonz~]echo $?
127
[jonz~]

Jonesy
-- 
  Marvin L Jones| Marvin  | W3DHJ  | linux
   38.238N 104.547W |  @ jonz.net | Jonesy |  OS/2
* Killfiling google  banter.com: jonz.net/ng.htm



Re: How to deal with errors in ()?

2015-03-09 Thread Allodoxaphobia
On Sun, 8 Mar 2015 22:05:29 +, Stephane Chazelas wrote:
 2015-03-07 18:01:18 -0600, Eduardo A. Bustamante López:
  But I am wondering if there is a walkaround to deal with errors in
  (). The ideal behavior should be that if there is a error in (),
  then we should not consider commandA is executed correctly even if its
  return status is 0.
 Again, address your questions to help-bash.
 [...]

 Are bash questions no longer on topic here? bash-bug used to be
 the place to discuss bash (before help-bash was created). It maps to the
 gnu.bash.bug newsgroup. I don't think help-bash maps to usenet
 (though you can access it over NNTP on gmane).

 There's a alt.comp.lang.shell.unix.bourne-bash but it doesn't
 look very lively.

comp.unix.shell



Bash --version issue

2014-09-25 Thread Allodoxaphobia
Earlier today I performed the `bash` security upgrade on my
 | [userid~]uname -rs
 | FreeBSD 10.0-RELEASE-p9
machine.  I thought to check the version level of `bash` to
see what I now have:

 | [userid~]man bash
 |  :
 |  :
 |   --version
 | Show  version information for this instance of bash
 | on the standard output and exit successfully.
 |  :
 |  :
 | [userid~]bash --version
 | [userid@vps ~]$ exit
 | exit
 | [userid~]

I'm pretty sure it's worked ok here in the past -- for an unknown
value of $PAST.

With an older `bash` on an old linux workstation:

 | $ bash --version
 | GNU bash, version 4.1.5(1)-release

Jonesy
-- 
  Marvin L Jones| Marvin  | W3DHJ  | linux
   38.238N 104.547W |  @ jonz.net | Jonesy |  OS/2
* Killfiling google  banter.com: jonz.net/ng.htm



Re: Bash --version issue

2014-09-25 Thread Allodoxaphobia
On Thu, 25 Sep 2014 23:04:46 -0400, Chet Ramey wrote:
 On 9/25/14, 9:41 PM, Allodoxaphobia wrote:
 Earlier today I performed the `bash` security upgrade on my
  | [userid~]uname -rs
  | FreeBSD 10.0-RELEASE-p9
 machine.  I thought to check the version level of `bash` to
 see what I now have:

 I can't reproduce this.  My patched version of bash gives

 $ ./bash --version
 GNU bash, version 4.3.26(3)-release (x86_64-apple-darwin13.1.0)
 Copyright (C) 2013 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

 This is free software; you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.

 on Mac OS X.  You might ask the FreeBSD ports folks, since it will
 probably be a while before I can look at this.

Ya, as is often the case, some packages in the FreeBSD ports 
seem to be fiddled with by the time they get to the user.

Just recently I had an issue with alpine that-a-way.
Compiling it from the maintainer's source yielded a copy that 
did not have the bug I encountered with the ports package.

Thanks for the quick reply!
Jonesy
-- 
  Marvin L Jones| Marvin  | W3DHJ  | linux
   38.238N 104.547W |  @ jonz.net | Jonesy |  OS/2
* Killfiling google  banter.com: jonz.net/ng.htm



Re: Replacing addresses

2013-11-28 Thread Allodoxaphobia
On Thu, 28 Nov 2013 09:09:28 -0600, Chris Down wrote:
 On 2013-11-28 08:23:01 -0400, Peter Cordes wrote:
  Oh, also, the online bug-bash archive has a bad habbit of replacing
 code with address@hidden.  There was a whole thread about setting
 PS1=whatever that is now a complete mystery to non-subscribers!

 Yes, let's please stop this useless obfuscation. If you *must*
 obfuscate, then it should at least be retrievable somehow that doesn't
 require clicking through tons of stuff. Besides, the list is archived in
 other places that don't do this, so it doesn't really help anyone.


 rot13   :-)




Re: protection against accidental massive pastes into the command line

2012-04-26 Thread Allodoxaphobia
On Fri, 27 Apr 2012 04:18:21 +0800, jida...@jidanni.org wrote:
 This would also save on later having to clean the massive blob out of
 the history list.

And, the Murphy's Law case(s) where one of the pasted lines 
contains a 'legitimate' linux command...  
Been there -- got a T-shirt.

Jonesy




Re: bash 3.2 vs 3.0

2012-01-07 Thread Allodoxaphobia
On Thu, 5 Jan 2012 10:12:34 +, Dave wrote:

 Recently upgraded to 3.2 

That's *not* an upgrade.  That's merely a 'change' in obsolescence.




Re: Help with script.

2010-05-19 Thread Allodoxaphobia
On Tue, 18 May 2010 10:08:54 -0700 (PDT), Afflictedd2 wrote:

 I'm tryin to build a script 

 Any help appreciated.

   comp.unix.shell



Re: operators available in bash versions

2009-11-30 Thread Allodoxaphobia
 (Didn't have the OP on the server to followup to. SRI)

 On 30 Nov 2009, at 12:12, Gerard wrote:
 
 I apologize for asking what is probably a dumb question, but where can
 I find a definitive listing of what features are available in each
 version of Bash.
 
 For example, I only have access to Bash-4 on my system. I need to know
 if  $(  also works on Bash  4. I also have a few questions
 regarding array handling.
 
 I am running FreeBSD-7.2 and installed Bash via ports.

You can, doncha know, install ports into $HOME?
Ergo, you could install bash 3.x and one or more earlier versions
in $HOME/bin/ and test your scripts to your heart's content.

I found the install 'tricks' via Google, but I don't remember the 
keywords I succeeded with beyond 'freebsd' and 'ports' now...

I successfully installed `alpine` in my FreeBSD shell account 
at a time when the SysAdmin only had `pine` installed.  WFM

HTH  GL
Jonesy
-- 
  Marvin L Jones| jonz  | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
* Killfiling google  banter.com: jonz.net/ng.htm




Re: Sed Question

2009-10-17 Thread Allodoxaphobia
On Wed, 14 Oct 2009 15:05:09 -0400, Greg Wooledge wrote:
 On Wed, Oct 14, 2009 at 12:24:30PM -0600, Bob Proulx wrote:
 Pierre Gaston wrote:
  Please consider asking in a sed mailing list like:
  http://sed.sourceforge.net/#mailing
  or maybe in the usenet group comp.unix.shell
 
 I would think help-gnu-ut...@gnu.org would be the better place to ask
 for help about GNU utilities.  :-)

 We don't know that he's using GNU sed.

But, we do know it ain't a bash bug.




Re: TIMEOUT

2009-04-04 Thread Allodoxaphobia
On Sat, 4 Apr 2009 08:37:32 -0300, Sergio Charpinel Jr. wrote:
 Hi,
 I'm in this mailing list, and I dont know if I am in the right place. If it
 doesnt, tell me.

  comp.unix.shell

I know, it's not very intuitive...
Jonesy
-- 
  Marvin L Jones| jonz  | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
* Killfiling google  banter.com: jonz.net/ng.htm