using asteriks in if statement in bash scripting

Hi Experts,

if [[ "$DBS" -eq 1 && "$DBS" -ne VFEEDBACK* ]]
 then
        DS=`echo "$i"`

How do I write the if statement in the correct way
DevSupportAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pawan KumarDatabase ExpertCommented:
Pls try-

if [[ "$DBS" -eq '1' && "$DBS" -ne 'VFEEDBACK*' ]]
0
DevSupportAuthor Commented:
@Pawan Kumar: Thank You, but I tried it and got an error, line 51: [[: VFEEDBACK*: syntax error: operand expected (error token is "*")
0
Pawan KumarDatabase ExpertCommented:
dont have system with me to check .. try this

if [[ "$DBS" -eq '1' && "$DBS" -ne VFEEDBACK'*' ]]
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

DevSupportAuthor Commented:
@pawan kumar:

I couldnt get that to work so I rewrote the script like this:

if [[ "$DBS" -eq 1 && "$DBS" != VFEEDBACK* ]]

this works.

Thanks for your help anyways!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tel2Commented:
Nice work, DevSupport.

Do you understand the reason your answer works?  If not, read on...
If you run the command:
    man test
you'll see that operators like "==" and "!=" are for comparing strings, and "-eq", "-ne", etc, are for comparing integers.

Also note that if, for example, "VFEEDBACK*" had a space (or various other characters) in it, like "VFEED BACK*" or "VFEEDBACK *", you'd need to surround it with quotes.
0
DevSupportAuthor Commented:
because my response works
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.