|
List Info
Thread: brace expansion and ksh?
|
|
| brace expansion and ksh? |

|
2007-10-11 17:35:27 |
I though ksh didn't have brace expansion. But today I was
reading the man
page and it was documented with an example.
But the example does not work:
$ ksh
$ echo a{c,b{X,Y},d}e
a{c,b{X,Y},d}e
$ bash
bash-3.2$ echo a{c,b{X,Y},d}e
ace abXe abYe ade
Even simple example in ksh doesn't work for me:
$ echo a{b,c,d,e}f
a{b,c,d,e}f
Now I see man page says in different section:
Once brace expansion has been performed, the shell replaces
file
name patterns with the sorted names of all the files that
match
the pattern (if no files match, the word is left
unchanged).
But that doesn't seem to work either in ksh:
$ echo {D,M}*
{D,M}*
$ bash
bash-3.2$ echo {D,M}*
DESCR MESSAGE Makefile Makefile.common
What is correct behaviour for ksh?
Jeremy C. Reed
|
|
| Re: brace expansion and ksh? |

|
2007-10-11 19:45:20 |
On 11/10/2007, Jeremy C. Reed <reed reedmedia.net> wrote:
> I though ksh didn't have brace expansion. But today I
was reading the man
> page and it was documented with an example.
>
> But the example does not work:
>
> $ ksh
> $ echo a{c,b{X,Y},d}e
> a{c,b{X,Y},d}e
> $ bash
> bash-3.2$ echo a{c,b{X,Y},d}e
> ace abXe abYe ade
>
> Even simple example in ksh doesn't work for me:
>
> $ echo a{b,c,d,e}f
> a{b,c,d,e}f
But see here:
$ exec ksh
$ echo a{c,b{X,Y},d}e
a{c,b{X,Y},d}e
$ exec ksh93
$ echo a{c,b{X,Y},d}e
ace abXe abYe ade
(the latter being of course the *real* thing - ast-ksh).
>
> Now I see man page says in different section:
>
> Once brace expansion has been performed, the
shell replaces file
> name patterns with the sorted names of all the
files that match
> the pattern (if no files match, the word is
left unchanged).
>
> But that doesn't seem to work either in ksh:
>
> $ echo {D,M}*
> {D,M}*
> $ bash
> bash-3.2$ echo {D,M}*
> DESCR MESSAGE Makefile Makefile.common
>
>
> What is correct behaviour for ksh?
AFAIU /bin/ksh is pdksh or thereabouts.
>
>
> Jeremy C. Reed
>
Chavdar Ivanov
|
|
| Re: brace expansion and ksh? |

|
2007-10-11 21:14:09 |
On Fri, 12 Oct 2007, George Abdelmalik wrote:
> > Even simple example in ksh doesn't work for me:
> >
> > $ echo a{b,c,d,e}f
> > a{b,c,d,e}f
>
> How about when you invoke a ksh with the braceexpand
option.
>
> $ ksh -o braceexpand
> $ echo a{c,b{X,Y},d}e
> ace abXe abYe ade
> $ uname -a
> NetBSD tb10.avdat.com.au 3.1 NetBSD 3.1 (tb10) #2: Wed
Jan 24 12:37:14 EST
> 2007 root tb10.avdat.com.au:/mnt/netbsd/obj/sys/arch/i386/compi
le/tb10 i386
Thanks. That worked.
I will now use: set -o braceexpand
The man page has documentation for brace expand in at least
four different
places. So I will probably work on that.
Next I need to figure out PR 34724
http://www.netbsd.org/cgi-bin/query-pr-single.pl?nu
mber=34724
I have $ in my PS1 so long current directories make it
so I can't
even see what I am typing. It is very inconvenient.
Jeremy C. Reed
|
|
| Re: brace expansion and ksh? |

|
2007-10-11 20:00:27 |
On Friday 12 October 2007 08:35, you wrote:
> I though ksh didn't have brace expansion. But today I
was reading the man
> page and it was documented with an example.
>
> But the example does not work:
>
> $ ksh
> $ echo a{c,b{X,Y},d}e
> a{c,b{X,Y},d}e
> $ bash
> bash-3.2$ echo a{c,b{X,Y},d}e
> ace abXe abYe ade
>
> Even simple example in ksh doesn't work for me:
>
> $ echo a{b,c,d,e}f
> a{b,c,d,e}f
How about when you invoke a ksh with the braceexpand
option.
$ ksh -o braceexpand
$ echo a{c,b{X,Y},d}e
ace abXe abYe ade
$ uname -a
NetBSD tb10.avdat.com.au 3.1 NetBSD 3.1 (tb10) #2: Wed Jan
24 12:37:14 EST
2007 root tb10.avdat.com.au:/mnt/netbsd/obj/sys/arch/i386/compi
le/tb10 i386
-
george.
|
|
| Re: brace expansion and ksh? |

|
2007-10-11 22:26:58 |
On Friday 12 October 2007 12:14, Jeremy C. Reed wrote:
> On Fri, 12 Oct 2007, George Abdelmalik wrote:
> > > Even simple example in ksh doesn't work for
me:
> > >
> > > $ echo a{b,c,d,e}f
> > > a{b,c,d,e}f
> >
> > How about when you invoke a ksh with the
braceexpand option.
> >
> > $ ksh -o braceexpand
> > $ echo a{c,b{X,Y},d}e
> > ace abXe abYe ade
> > $ uname -a
> > NetBSD tb10.avdat.com.au 3.1 NetBSD 3.1 (tb10) #2:
Wed Jan 24 12:37:14
> > EST 2007
> > root tb10.avdat.com.au:/mnt/netbsd/obj/sys/arch/i386/compi
le/tb10 i386
>
> Thanks. That worked.
>
> I will now use: set -o braceexpand
>
> The man page has documentation for brace expand in at
least four different
> places. So I will probably work on that.
>
> Next I need to figure out PR 34724
> http://www.netbsd.org/cgi-bin/query-pr-single.pl?nu
mber=34724
>
> I have $ in my PS1 so long current directories
make it so I can't
> even see what I am typing. It is very inconvenient.
I too find it a little annoying. I often hit this issue with
the configure
line of packages which have many --enable or --with options.
Never been
bothered enough by it to try an fix it myself but would
appreciate it very
much if it was. If you come up with a patch that you'd like
someone to try
out then I'd be happy to.
-
george.
|
|
| Re: brace expansion and ksh? |

|
2007-10-19 03:45:44 |
On Fri, Oct 12, 2007 at 01:55:00PM +0000, Valeriy E. Ushakov
wrote:
> Jeremy C. Reed <reed reedmedia.net> wrote:
>
> > Next I need to figure out PR 34724
> > http://www.netbsd.org/cgi-bin/query-pr-single.pl?nu
mber=34724
> >
> > I have $ in my PS1 so long current
directories make it so I can't
> > even see what I am typing. It is very
inconvenient.
>
> I've read the PR and it's not quite clear to me what
the complain is?
>
> | If your ksh command line becomes long, it often
doesn't wrap around
> | console to next line well
>
> What do you mean by "often" - that it wraps
sometimes and not others?
>
> I normally use bash with "set
horizontal-scroll-mode on" in .inputrc,
> I tried ksh and it's very similar to what I'm used to
except libedit
> seems to scroll more agressively.
How is libedit relevant? neither bash nor pdksh use it.
Pavel
|
|
| Re: brace expansion and ksh? |

|
2007-10-19 10:18:56 |
On Thu, Oct 11, 2007 at 09:14:09PM -0500, Jeremy C. Reed
wrote:
>On Fri, 12 Oct 2007, George Abdelmalik wrote:
>
>Next I need to figure out PR 34724
>http://www.netbsd.org/cgi-bin/query-pr-single.pl?nu
mber=34724
>
sometimes, using command history to edit commands, I end up
with one liners that are several lines long, and yes it
becomes
difficult to review before hitting enter.
One way around it is to use ctrl-a or however get to the
beginning
of the line, add a # and enter the line as a comment. then
with it
in history buffer you can easily review with the h alias
"fc -l",
which wraps.
since I'm tropically using xterm I can then carefully mouse
copy
and paste the line I want, or just read it into a file and
make a
script.
(if someone knows how to make the home/end keys work from
mac
xterm, that would be a big help)
// George
--
George Georgalis, information system scientist
<IXOYE><
|
|
| Re: brace expansion and ksh? |

|
2007-10-22 00:15:29 |
On Sun, Oct 21, 2007 at 07:15:53PM -0400, James K. Lowden
wrote:
>George Georgalis wrote:
>> (if someone knows how to make the home/end keys
work from mac
>> xterm, that would be a big help)
>
>What does "work" mean? When I press Fn + Left
Arrow, the cursor goes to
>the beginning of the line....
>
> $ echo $SHELL
> /bin/bash
That is not on NetBSD? I was quite happy with bash
till I found zsh. That lasted till I found the
NetBSD port of ksh, which is very good.
In bash I used the following .inputrc so PC keyboard
keys (home/end) worked in both console and xterm:
# see 'bind' in bash(1)
# make the home and end keys work in xterm
"e[H": beginning-of-line
"e[F": end-of-line
# make the home and end keys work in console
"e[1~": beginning-of-line
"e[4~": end-of-line
oh, whooho, I got it. with these lines sourced from
a file or in .profile (you cannot enter the esc char
in a ksh shell), that's an esc char followed by two
normal characters.
bind '^[[H'=beginning-of-line
bind '^[[F'=end-of-line
bonus, the bindings work directly in a screen(1) session.
// George
--
George Georgalis, information system scientist
<IXOYE><
|
|
| Re: brace expansion and ksh? |

|
2007-10-22 09:36:31 |
On Mon, Oct 22, 2007 at 01:15:29AM -0400, George Georgalis
wrote:
>On Sun, Oct 21, 2007 at 07:15:53PM -0400, James K.
Lowden wrote:
>>George Georgalis wrote:
>>> (if someone knows how to make the home/end keys
work from mac
>>> xterm, that would be a big help)
>>
>>What does "work" mean? When I press Fn +
Left Arrow, the cursor goes to
>>the beginning of the line....
>>
>> $ echo $SHELL
>> /bin/bash
>
>That is not on NetBSD? I was quite happy with bash
>till I found zsh. That lasted till I found the
>NetBSD port of ksh, which is very good.
>
>In bash I used the following .inputrc so PC keyboard
>keys (home/end) worked in both console and xterm:
>
># see 'bind' in bash(1)
># make the home and end keys work in xterm
>"e[H": beginning-of-line
>"e[F": end-of-line
># make the home and end keys work in console
>"e[1~": beginning-of-line
>"e[4~": end-of-line
>
>oh, whooho, I got it. with these lines sourced from
>a file or in .profile (you cannot enter the esc char
>in a ksh shell), that's an esc char followed by two
>normal characters.
>
>bind '^[[H'=beginning-of-line
>bind '^[[F'=end-of-line
>
>bonus, the bindings work directly in a screen(1)
session.
Dang, no need for literal escape codes in .profile
the plain ascii caret notation below works...
bind '^XH'=beginning-of-line
bind '^XF'=end-of-line
I did read the man page and try to set this up, way
before, but for some reason, at that time, never got
it right. Is there any reason these aren't bound by
default?
// George
--
George Georgalis, information system scientist
<IXOYE><
|
|
[1-9]
|
|