0

I want to have a simple script to search for a device model that has the ID of 0400. I am getting syntax error on the if line.

#!/bin/bash

lp=$(lspci -vvv | grep -ic "device 0400")
if [$lp -ne 2] 
then 
    echo "Card model is incorrect"
fi
Ilmari Karonen
  • 49,047
  • 9
  • 93
  • 153
  • Tip: you can install an editor plugin for [shellcheck](http://shellcheck.net) to automatically have such issues identified as you type. – that other guy Feb 01 '18 at 19:58

1 Answers1

0

Spaces around test are mandatory :

if [ $lp -ne 2 ] 
Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223