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

Re: bash syntax



* 2021-07-29 21:16:26+0100, mick crane wrote:

>    4 ((ct++))
>    5 scanimage > /home/mick/DATA/SCANS/scan-$ct.pnm

Items 4 and 5 could be combined using $((++ct)):

    scanimage > /home/mick/DATA/SCANS/scan-$((++ct)).pnm

> What's the thing with the ct being in double brackets and not having
> the "$" ?

You have already got answers but here is another. Bash has a special
arithmetic evaluation mode which happens in:

    let ...          # returns true (0) or false (1)
    (( ... ))        # returns true (0) or false (1)
    $(( ... ))       # returns the value of the expression

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450

Attachment: signature.asc
Description: PGP signature


Reply to: