sh - shell script works but drop error "line[8] expected argument [" -


i have shell script works (does want do,finds if listed user online), each time drop error "line[8] expected argument [". i've tried using == same thing. there's code:

#!/bin/sh truth=0; until [ $truth -eq 1 ]      i;     isthere=$(who here | awk '{print $1}' | grep $i)     if [ $isthere = $i ] #(8 line here)                 echo "found user: "$isthere". program close.";         exit 0;     fi     done echo "user not found, retrying after 3sec..."; sleep 3; done 

thank you , time.

looks $isthere or $i empty. should quote them: if [ "$isthere" = "$i" ]

in other news: semicolons useless; semicolon not statement terminator, statement separator, along newline.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -