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
  • 47,645
  • 9
  • 89
  • 149
  • 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 Quenot
  • 154,891
  • 35
  • 213
  • 206