Looking for a simple ways to output the byte at which two strings differ. Here
is one:
cmp <(echo "hello") <(echo "help") | cut -d' ' -f5 | tr -d ,
Any other suggestions?
--
Yorick
The syntax I'm currently using to access the last element of an array looks a
little evil:
>arr=( one two three )
>echo ${arr[$(([EMAIL PROTECTED]))]}
three
If there is not currently a friendlier syntax for this, might I suggest:
${arr[-1]}
--
Poor Yorick
___
> ---Original Message---
> From: Nathan Coulter <[EMAIL PROTECTED]>
> Subject: Re: mkfifo and tee within a function
> Sent: 2006-11-28 17:19
> I think that is true for an anonymous pipe, but not for a named pipe.
> Timing is not the issue here. A command
Hi,
Within a function, I'd like to print some input to the terminal and at the same time
store it in a fifo fostore some input in a fifo, but am getting mixed results. In this
example, I thought "hello" would be output twice:
$>cmd_print () { mkfifo zout ; (tee zout &); cat zout ; rm zout; }
> From: Andreas Schwab <[SNIP]>
> Subject: Re: mkfifo and tee within a function
> Sent: 2006-11-28 15:09
>
> Nathan Coulter <[SNIP]> writes:
>
> > Could anyone please provide a few pointers on how to accomplish this, and
> perhaps explain the re
Hi,
Within a function, I'd like to print some input to the terminal and at the same time
store it in a fifo fostore some input in a fifo, but am getting mixed results. In this
example, I thought "hello" would be output twice:
$>cmd_print () { mkfifo zout ; (tee zout &); cat zout ; rm zout; }
Chet Ramey wrote:
"Nathan Coulter" <[EMAIL PROTECTED]> writes:
read -d $'\0' will do most of what you want, with one limitation. The
This is actually equivalent to read -d ''.
So, to recap, the way to read null-delimited data
> From: Chet Ramey <[EMAIL PROTECTED]>
> Subject: Re: read command and ascii null as delimiter
> Sent: 2006-09-08 08:49
>
> Nathan Coulter wrote:
> > Feature request: an option, maybe "-0" to use ascii null as the delimiter
> for the "re
I'd like to use a bash script in a pipe to process null-delimited output:
| myscript > results
Since the "read" command seems to currently be unable to use ascii null as a
delimiter, I'm using xargs to parse the file and feed to a subshell:
*** contents of myscript***
cat <&0 | xargs -0 -n2 b
Feature request: an option, maybe "-0" to use ascii null as the delimiter for
the "read" command. It would make the following two commands produce the same
output:
[EMAIL PROTECTED]:~/tmp5$ printf 'hello\000there' | xargs -n1 -0 echo
hello
there
[EMAIL PROTECTED]:~/tmp5$ printf 'hello\000there
10 matches
Mail list logo