0

I'm trying to create a simple flag variable in an UNIX shell script so that during downtime I can turn off certain processing.

When I do an if statement, keep getting a command not found error.

Code:

#!/bin/bash

hold=false

if [$hold = false]
then
  echo "$hold" > ADW_UNIX.dat
fi

exit 0

Error:

13:03:05 # ./ADW_UNIX.script
./ADW_UNIX.script: line 5: [false: command not found
Cyrus
  • 84,225
  • 14
  • 89
  • 153

1 Answers1

0

Not sure about your complete requirement as you haven't thrown light on same, so trying to fix your script itself.

#!/bin/bash    
hold="false"    
if [[ "$hold" == "false" ]]
then
  echo "$hold" > ADW_UNIX.dat
fi
exit 0
RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93