help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cant fix error .. findff.1: line 110: g18.mkv.mp4: syntax error: inv


From: alex xmb ratchev
Subject: Re: cant fix error .. findff.1: line 110: g18.mkv.mp4: syntax error: invalid arithmetic operator (error token is ".mkv.mp4")
Date: Mon, 19 Jun 2023 07:35:13 +0200

On Mon, Jun 19, 2023, 01:04 Dennis Williamson <dennistwilliamson@gmail.com>
wrote:

>
>
> On Sun, Jun 18, 2023, 2:05 PM alex xmb ratchev <fxmbsw7@gmail.com> wrote:
>
>> i code on random user request scripts .. this one s one
>> to find path s and ffmpeg to otherwhere
>> suddenly , the error i dont understand
>>
>> findff.1: line 110: g18.mkv.mp4: syntax error: invalid arithmetic operator
>> (error token is ".mkv.mp4")
>>
>> that line s
>>
>>  if [[ ${A[$c]} == "${A2[$c]}" && ! -e "$w" ]] ; then
>>
>> which means as much as
>> size of file $c == size of same , but 27s earlier ( $wait loop sleep time
>> )
>> and if ! $w ( tmp fs element ) exists
>>
>> i moved and even removed the $w part , .. error is still showing
>>
>> the last -x lines besides look like this
>>
>> + readsav
>> + [[ -e /data/data/com.termux/files/home/.findff ]]
>> + for c in "${!C[@]}"
>> + f=/data/data/com.termux/files/home/aotin/g18.mkv
>> + o=/data/data/com.termux/files/home/aot/g18.mkv.mp4
>> + w=/data/data/com.termux/files/home/.findff.tmp/g18.mkv.mp4
>> + d=/data/data/com.termux/files/home/aot
>>
>>   < marker >
>>
>> + declare -p A A2 C
>> declare -A A=([g18.mkv.mp4]="329474152" [m1.avi.mp4]="225827840" )
>> findff.1: line 108: declare: A2: not found
>> declare -A
>> C=([g18.mkv.mp4]="/data/data/com.termux/files/home/aotin/g18.mkv"
>> [m1.avi.mp4]="/data/data/com.termux/files/home/aotin/m1.avi" )
>>
>>   < marker >
>> here see A has two valid entries
>> filename / size
>>
>> + declare -p
>>
>> < long declare -p output till few last entries >
>>
>> declare -- threads="6"
>> declare -- tmp="/data/data/com.termux/files/home/.findff.tmp"
>> declare -- w="/data/data/com.termux/files/home/.findff.tmp/g18.mkv.mp4"
>> declare -- wait="27s"
>> declare -x xt_="1"
>> findff.1: line 110: g18.mkv.mp4: syntax error: invalid arithmetic operator
>> (error token is ".mkv.mp4")
>> + [[ /data/data/com.termux/files/home/.findff.tmp != / ]]
>> + rm -rf /data/data/com.termux/files/home/.findff.tmp
>> ~ $
>>
>> from test cmd running
>> xt_=1 bash -x findff.1
>> xt_ to set default test args
>>
>> so error is in
>>
>> [[ ${A[$c]} == "${A2[$c]}" ]]
>>
>> .. no idea to fix it ..
>>
>> just on a note , on first run there is no A2 assoc , but never seen such
>> cause such
>>
>> .. btw its also the code with the C() s for mapfile
>>
>> greets , alex xmb software
>>
>
> If A2 doesn't exist yet then references to it are treated as if it were a
> numerically indexed array but you're trying to access an element using a
> non-numeric index which has a period (decimal point) in it. That makes it
> look like a floating point numbers which Bash doesn't support. Remember
> that the subscript of a numerically indexed array is an arithmetic context.
>
> To fix the problem make sure you declare A2 as associative before your
> first reference to it.
>

thank you mate , code s working now .. :)
was a big missed of my side .. :))

thx .. greets

>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]