0

Would you be able to help me with this script? I am learning how to create scripts in bash. It should be working but somehow it is not.

#!/bin/bash
echo "Please enter your name: "
read name
if ["$name"="Marek"]
then
echo -e "Hello Marek!\n"
else
echo "Sorry not you"
fi

Output:

mhudak@nelke:~/practice_before_Exam> ./script2.sh
Please enter your name:
Marek
./script2.sh: line 4: [Marek=Marek]: command not found
Sorry not you


SUSE Linux Enterprise Server 11 (i586)
VERSION = 11
PATCHLEVEL = 1
Freddy
  • 25,565
Marek
  • 1

1 Answers1

0

Try this:

#!/bin/bash
echo "Please enter your name: "
read name
if [ "$name" = "Marek" ]; then
    echo -e "Hello Marek!\n"
else
    echo "Sorry not you"
fi