> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Fixing "zsh: bad assignment" error in Linux
- URL: https://itsfoss.com/solve-zsh-bad-assignment/
- Published: 2013-04-10T23:55:08.000Z
- Updated: 2023-08-07T05:29:04.000Z
- Description: Read to find out what caused the zsh: bad assignment error in Linux and how you can fix it.
- Author: Abhishek Prakash
- Tags: Troubleshoot 🔬

The other day I was trying to [create an alias in Linux](https://linuxhandbook.com/linux-alias-command?ref=itsfoss.com) for repetitive commands. An alias is a name that is translated as another name or command (or a set of commands).

So, I tried to create the alias in the following manner:

```
alias my_short_command = "command 1; command 2  && command 3; command 4"
```

And it threw me the following error:

```
zsh: bad assignment
```

If you are a regular user of the Linux command line, you must have identified the error on the previous command. But I was preoccupied with my program in C++ and I did not notice the obvious error here.

In fact, I thought it to be an error with the way I used the combination of error for the alias. So, I fiddled for a couple of minutes and just to make sure what I was doing wrong, tried this command:

```
alias l = "ls -lrt"
```

Now, I was certain that there was no error with the commands this time but I git the same result as above:

```
zsh: bad assignment
```

And that’s when I realized my mistake. You see, I have been working a lot with C++ and was following the standard of using spaces before and after the assignment operator (=). And that is what I used here as well. And shell does not like the wastage of “space”.

**I removed the extra white spaces before and after the = and voilà! There it worked like a charm.**

In fact, the same error can be encountered with the [export command](https://linuxhandbook.com/export-command/?ref=itsfoss.com) as well or any other variable assignments in the shell. There should not be spaces before and after equals sign.

This taught me a lesson to not waste white space while dealing with shell scripts and Linux commands. It’s not the same as writing programs in other languages.

I would add this tiny learning lesson to my list of things to know about the Linux terminal.

[19 Basic But Essential Linux Terminal Tips You Must KnowLearn some small, basic but often ignored things about the terminal. With the small tips, you should be able to use the terminal with slightly more efficiency.![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/wordpress/2021/12/ubuntu-terminal-basic-tips.png)](https://itsfoss.com/basic-terminal-tips-ubuntu/)

I hope you would not have to waste your time with this problem if you mind those spaces before and after the equals sign.