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
___
Thanks Paul and Chet;
They both do the same thing and that's exactly what I was looking for.
Thanks again,
Matthew.
Chet Ramey wrote:
>
> Paul Jarc wrote:
>
>> date1=`perl -e 'print time()'`
>> ...
>> date2=`perl -e 'print time()'`
>> interval=`expr "$date2" - "$date1"`
>
> This general ap
Sorry guys, I need to take it a step further and am hitting a wall at the
moment;
I need to take two results (from you examples), compare them and get a final
result. What I have thus far is;
operation()
{
echo >> $LOG
echo Running operation>> $LOG
for i in a b
do
Matthew_S wrote:
> interval$i=$(($date2 - $date1)) #1st & 2nd errors
> ...
> I'm getting the errors;
> ./file.sh: line x: intervala=1: command not found
> ./file.sh: line x: intervalb=1: command not found
> ./file.sh: line x: - : syntax error: operand expected (error token is " ")
Matthew_S <[EMAIL PROTECTED]> writes:
> Sorry guys, I need to take it a step further and am hitting a wall at the
> moment;
>
> I need to take two results (from you examples), compare them and get a final
> result. What I have thus far is;
>
> operation()
> {
> echo >> $LOG
> echo Running
Bo Ørsted Andresen wrote:
> Bash Version: 3.2
> Patch Level: 15
> Release Status: release
>
> Description:
> If a function f set a variable v to $'\001' then type f or set
> add a second \001 in it's output. Hence v becomes $'\001\001'.
> You'll need to use a hex viewer (in the exampl