I guess this one should have gone to Isaac and the list.

---------- Forwarded message ----------
From: Beni Cherniavsky <[email protected]>
Date: Mon, Jun 15, 2009 at 11:39
Subject: Re: [Fish-users] Fish, what the heck?
To: [email protected]


On Sun, Jun 14, 2009 at 17:13, Jan Kanis<[email protected]> wrote:
> On Fri, Jun 12, 2009 at 20:33, Isaac
> Dupree<[email protected]> wrote:
>> inherited as an environment variable that contains colons; I expect it
>> to be spit out again as an environment variable that contains colons
>> which work, not spaces that don't!
>
> makes sense to me, I wonder what uses there are for joining quoted
> array vars with spaces. Can anyone enlighten me? or perhaps this could
> be changed.
>
+1 to change "$var" to use colons.
Consistency: fish already uses them for import and export of envvars.
Usefulness: Isaac gave the perfect example why spaces are broken.

>> If there's a secret way to do it anyway (I'd prefer to get colons and
>> use the standard external tool 'env', than to use Fish-specific "set
>> -lx" style stuff) , I'd appreciate hearing.

Ugly but maybe simplest workaround:
   bash -c "PATH=~/temp/strangepath:\$PATH program"
leaving expansion of $PATH to bash itself.

Ah, and there is always good old "printenv":
   env PATH=~/temp/strangepath:(printenv PATH) bash -c "program"

>
> What I really like about fish is that it's scriptable and that I can
> actually remember the syntax to do so without the manpages (unlike
> bash et al):
>
> me ~> function colonjoin
>               set -l first 1
>               for x in $argv
>                   if test $first -eq 1
>                       set first 0
>                   else
>                       echo -n :
>                   end
>                   echo -n $x
>               end
>           end
> me ~> cat ~/temp/strangepath/program
> #!/bin/sh
> echo Hello Colon World!
> me ~> env PATH=~/temp/strangepath:(colonjoin $PATH) bash -c program
> Hello Colon World!
> me ~>
>
What I really like about fish is how cleanly it handles arrays:
function colonjoin
  printf ':%s' $argv | cut -c 2-
end

printf is quite useful with fish arrays.
But very frequently I would like to have a "join SEP WORDS" command that
places N-1 separators between N words.  And "split SEP STRING" while at that.

>> Or will I be frustrated
>> enough to write my own Bash-wrapping shell in Haskell? :-) (I guess the
>> basic way to do that would involve my process spawning a "bash" process
>> whose stdin consisting of command lines is attached to my process... I
>> hope there aren't too many gotchas there; I wonder how terminal-seizing
>> processes like 'less' work then...)
>
> Browsing through some old fish-users posts I learned that there exist
> things like terminal groups and terminal group leaders, and probably
> lots more ugly terminal handling related stuff I don't want to know
> about, which (I think) all lives in kernel-mode land. I suppose you'll
> at least need to make the subshell talk to haskell through a pseudo
> tty, like screen does.

Yep, terminal handling w.r.t. job control is the dragon lair of unix :-(.
See http://www.gnu.org/software/libc/manual/html_node/Job-Control.html
for the gory details.  What you want to do is extremely hard!
In all history of Unix, I know of only one program to attempt it -
the Midnight Commander - and it didn't work very well.

The only sane way to do it is to hack on bash itself, which knows when
it has control of the terminal and when it's running another command.
I'd start by hacking "readline".  But even there, getting multi-line editing
is going to be tricky.

> If you're going to hack away yourself anyway,
> you could also consider adapting the fish sources to your needs and
> running your own version (and sharing any bugfixes you make while
> you're at it).
>
I be happy to see a "readmultiline" library extracted from fish, because
I'd also like to see it in Python ;-).  But I don't have the time to
do it myself.

There is http://codespeak.net/pyrepl/ that implemented multi-line editing
in pure Python, whose implementation might give you some ideas.

--
Beni <[email protected]>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to