Rusty
Rusty

Reputation: 384

Script not executing properly.

I am writing a script in linux and when I run it, it seems like it is trying to run every line as a command?

My script is like this

#!/bin/bash
#add user script

clear
curUser = "$(whoami)"

Welcome to the user management application, $curUser.
1.)Add User.
2.)Modify User.
3.)Delete User.
4.)See Last 10 User Created.
5.)Quit

I did chmod +x Manage-Users.sh

ran it with ./Manage-Users.sh

my output is this : ./manage-users.sh: line 4: curUser: command not found. There are a couple other lines with similar outputs. Why is this happening?

Upvotes: 1

Views: 31

Answers (1)

mayank_io
mayank_io

Reputation: 440

Have you tried removing the space before and after the assignment operator = ?

That line could be written as: curUser="$(whoami)"

Upvotes: 1

Related Questions