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
Post a Comment