Why does this script give error?#!/bin/bash# This script checks whether # the current user is root or # not.if [ $UID -ne 0 ] then    echo Non-root user.else    echo Root user.Fi    Outputmyuser@kali:~$ ./user.sh./user.sh: line 7: syntax error near unexpected token `else'./user.sh: line 7: `else'myuser@kali:~$
Why does this script give error?
shell script;kali linux
You have forgot to put ; between if and then:if [ $UID -ne 0 ]; then    echo Non-root user.else    echo Root user.fiAlso the if conditional construct ends with fi, not Fi.; is basically a shorthand for newline. If you want you can use then in the next line to avoid ;:if [ $UID -ne 0 ]then    echo Non-root user.else    echo Root user.fi