[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 861
  • Last Modified:

Ksh if statement

Hi,
When I run this script I get following error. Can someone comment on the error. Thanks, Ez.

#!/bin/ksh
date
if [[$LOGNAME != "boo"]]
      then
      echo This Script can only be executed by boo
      exit 1
fi
exit

ERROR ON UNIX
Fri Apr 17 13:05:34 EDT 2009
prg.sh[3]: [[boo:  not found
0
ezsas
Asked:
ezsas
  • 3
  • 2
1 Solution
 
omarfaridCommented:
try

#!/bin/ksh
date
if [ $LOGNAME != "boo" ]
      then
      echo This Script can only be executed by boo
      exit 1
fi
exit
0
 
ezsasAuthor Commented:
Hi Omar,
Still the same error. It is just one '[' instead of '[[', but the error is same.
Ez
 
0
 
omarfaridCommented:
did you leave space after [ and before ] ?
0
 
ezsasAuthor Commented:
Thanks Omar.
0
 
omarfaridCommented:
welcome :)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now