Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8384125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:19:52+00:00 2026-06-09T17:19:52+00:00

I have this code. But I always get an error line 34: [24: command

  • 0

I have this code. But I always get an error line 34: [24: command not found.

It should execute the code in the if statement as soon as the do while loop executet the 24 time.

#!/bin/bash

input="./user.cvs"

latexStart="\\documentclass[12pt]{article}\\usepackage{labels}\\usepackage{graphicx}\\usepackage{array}\\begin{document}\\graphicspath{{./QRcodes/}}\\newcolumntype{C}{>{\\centering\\arraybackslash} m{27mm} }"

latexEnd="\\end{document}"

latexBeginLabels="\\begin{labels}"

latexEndLabels="\\end{labels}"

counter=0

touch newLabels.txt

echo "$latexStart" >> newLabels.txt

echo "$latexBeginLabels" >> newLabels.txt

while IFS=';' read -r f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13
do

path="./QRcodes/$f2$f3.png"

vcard="BEGIN:VCARD%0AN;CHARSET=utf-8:$f3;$f2;;$f1;%0AADR;CHARSET=utf-8;INTL;PARCEL;WORK:;;$f10;$f11;;$f12;$f13%0AEMAIL;INTERNET:$f6%0AORG:$f4%0ATEL;WORK:$f8%0ATEL;FAX;WORK:$f9%0ATITLE:$f5%0AURL;WORK:$f7%0AEND:VCARD"

encodedVCard=$(echo "$vcard" | sed -e 's/\+/\%2B/g')

url="http://api.qrserver.com/v1/create-qr-code/?size=300x300&data=$encodedVCard"

wget -O "$path" "$url"

if ["${counter:-0}" -gt 21] ;
    then
        counter=0
        echo "$latexEndLabels" >> newLabels.txt
        echo "\\newpage" >> newLabels.txt
        echo "$latexBeginLabels" >> newLabels.txt
fi

echo "\\begin{tabular}{ C C } \\includegraphics[height=30mm]{name.png} & Name Man \\\\ \\end{tabular}" >> newLabels.txt

let counter=counter+1

done < "$input"

echo "$latexEndLabels" >> newLabels.txt
echo "$latexEnd" >> newLabels.txt

The error is in Line 34, if ["${counter:-0}" -gt 21] ;. I got this example from Compare integer in bash, unary operator expected
What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:19:53+00:00Added an answer on June 9, 2026 at 5:19 pm

    You need

    if [ "${counter:-0}" -gt 21 ]; then ...
    

    i.e. your conditional statement is separated from the surrounding square brackets by spaces.

    I’m quoting counter to be safe, but if you’re sure it’ll never be empty then you can skip that. It’s probably better to be safe than sorry, however, and follow your original pattern.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this line of code but it throws an error. What is the
I am trying to deserialize a stream but I always get this error End
Hey I have this code but it doesn't work because it is expecting a
I have write this code but it does work only if I am already
I have this code that runs but never stops. class A { public static
I have this vb.net code ( but I think meaning code is equivalent for
i have this code and its working but i want it to return dailyTotals
I have this code that works in a unit test but doesn't work when
I have this code so far which perfectly but relies on there being a
I have this code to draw an ellipse in the screen but I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.