It's FOSS

Fixing "zsh: bad assignment" error in Linux

Abhishek Prakash

The other day I was trying to create an alias in Linux 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:

And it threw me the following error:

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:

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

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 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.

bad assignment error

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

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

No Camera Found? Getting the Camera App to Work in Ubuntu 24.04

Open external links in appimage for login, fixing applications icon missing from the launcher in ubuntu, reset forgotten root password in ubuntu, handling 'cannot refresh snap-store' error in ubuntu 24.04, become a better linux user.

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Your link has expired.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications You must be signed in to change notification settings

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(emotty): fix bad assignment error #9714

Conversation.

dracorp

dracorp commented Mar 8, 2021

Standards checklist:.

  • The PR title is descriptive.
  • The PR doesn't replicate another PR which is already open.
  • I have read the contribution guide and followed all the instructions.
  • The code follows the code style guide detailed in the wiki.
  • The code is mine or it's from somewhere with an MIT-compatible license.
  • The code is efficient, to the best of my ability, and does not waste computer resources.
  • The code is stable and I have tested it myself, to the best of my abilities.

Removed redundant spaces to prevent:

Sorry, something went wrong.

@dracorp

Successfully merging this pull request may close these issues.

@dracorp

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Why does Zsh complain of my variable assignment as "command not found"?

When I try to write a Zsh script on macOS Big Sur, Version 11.5.1, I noticed that it keeps failing to recognize my variables as variables.

Instead, Zsh treats them as UNIX-like commands.

Screenshot of the problem on the Terminal Application - variable assignment problem for Zsh shell scripts

In the screenshot linked above, I did the following on the Terminal application.

  • Showed the contents of the simple Zsh shell script.
  • Used the "ls -l" UNIX-like command to indicate its file permissions, and show that it is an executable Zsh shell script.
  • Executed the Zsh shell script, which shows that the Zsh script interpreter complains of how my variable name is a "command not found".

The source code for my Zsh shell script is provided as follows:

Can you please kindly let me know what am I missing, and what did I do wrong?

I just want to assign values to variables in my Zsh shell scripts.

Thank you so much, and have a great day! Ciao!

  • macos-bigsur

Giovanni's user avatar

The syntax to assign a value to a variable is foo=bar , not foo = bar . Whitespaces matter. The latter syntax is a command foo with arguments = and bar .

Few examples of how = is interpreted:

code meaning
proper assignment; now the value of is
command with arguments and
command with one argument
command with in its environment; the value of is empty
command with in its environment; the value of is
proper assignment; now the value of is
proper assignment; now the value of is (note the leading space)
proper assignment; now the value of is (note the leading space)
command (because is not a valid name for a shell variable)

This is not specific to Zsh. The POSIX shell ( sh ) and POSIX-compliant shells behave this way. Zsh (while not being POSIX-compliant in general) also follows.

Kamil Maciorowski's user avatar

  • My upvote can only be recorded but not cast, since my reputation score is low for the "Super User" site of Stack Exchange. That said, thank you so much! It makes a lot of sense now. –  Giovanni Commented Aug 12, 2021 at 19:17

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged macos shell zsh macos-bigsur ..

  • The Overflow Blog
  • Masked self-attention: How LLMs learn relationships between tokens
  • Deedy Das: from coding at Meta, to search at Google, to investing with Anthropic
  • Featured on Meta
  • User activation: Learnings and opportunities
  • Preventing unauthorized automated access to the network

Hot Network Questions

  • 2 NICs, PC is trying to use wrong one
  • All of them in order
  • Informal "chats" with potential grad school advisors
  • Book where the humans discover tachyon technology and use this against a race of liquid metal beings
  • White (king and 2 bishops) vs Black (king and 1 knight). White to play and mate in 2
  • Which ancient philosopher compared thoughts to birds?
  • Is a 1500w inverter suitable for a 10a portable band saw?
  • Story where the main character is hired as a FORTH interpreter. We pull back and realise he is a computer program living in a circuit board
  • Problems regressing y on x/y?
  • Does history possess the epistemological tools to establish the occurrence of an anomaly in the past that defies current scientific models?
  • How does Linux kernel use Intel SGX (Software Guard Extensions)?
  • What is the name for this BC-BE back-to-back transistor configuration?
  • Are C3 and S3 operations equivalent for C3h point group?
  • \ContinuedFloat with three table not working
  • Why is my Lenovo ThinkPad running Ubuntu using the e1000e Ethernet driver?
  • Does this work for page turns in a busy violin part?
  • This puzzle is delicious
  • Letter of Recommendation for PhD Application from Instructor with Master Degree
  • Is there a fast/clever way to return a logical vector if elements of a vector are in at least one interval?
  • Converting a set of reactions represented by strings separated by spaces to a list of similar strings
  • How to format units inside math environment?
  • Showing that a ball is a convex set
  • is it correct to say "can you stop clinking the cup of coffee"?
  • Taking out the film from the roll can it still work?

bad assignment error

bad assignment error

  • This Thread
  • Blog Articles
  • More Options

 width=

PRIO-063 Bad I/O asg error. How to fix?

  • June 29, 2017 at 5:05 PM
  • Thread is Resolved

We have a pair of (used - new to us) Fanuc R-2000iA/210F robots with R-J3iB controls (Handling Tool Version V6.40-1K). I am currently getting a PRIO-063 Bad I/O asg error: Rack 85 Slot 21 error on both robots. It doesn't seem to affect them in their tasks/programs, but it's annoying seeing it on the screen (and maybe it does affect them in some way). After some research I found that Rack 85 is the ControlNet rack. These robots do not have the ControlNet cards installed. The programs I've created do not call these addresses at all. Under this error ( http://alarmcodes.com/fanuc-robot-al…-rack-d-slot-d/ ), it says to delete or update the assignments, but to this time I haven't been able to figure out how or where.

When I go to the I/O ControlNet board detail, I get:

Board: 1 Status: NOBOARD Motherboard: Full-slot Operation mode: ADPTR Param Change Mode: NET ULK Input error state: ZERO Scanner Err sevrty: STOP Adapter Err sevrty: WARN

ControlNet Parameters: MAC-ID: 30 NUT (us): 100000 SMAX: 0 UMAX: 99 Slot (us): 254 Gbpre (10us): 92 Gbstrt (10us): 61 Gbcenter (10us): 45

In Device List (DEV-LST) there is also a device with the following settings:

Input Header Words: 0

Status: ON MAC ID: 0 Device Name: [ ] Comment: [ ] Vendor ID: 0 Device Type: 0 Prod Code: 0 Maj Rev: 0 Min Rev: 0 Digital Inputs: 0 Digital outputs: 0 Analog Inputs: 0 Analog Outputs: 0 O-T RPI (us): 0 T-O RPI (us): 0 Path: [ ]

When I checked the SUMMARY.DG file (which I found during my research), it shows RACK 85 SLOT 21 under the following I/O:

IO CONFIGURATION::

DIN[ 1] START CYCLE DIN[ 4] RECIPE 1 DIN[ 5] RECIPE 2 DIN[ 6] RECIPE 3 DIN[ 7] RECIPE 4 DIN[ 8] RECIPE ENABLED DIN 1 - 8 RACK: 1 SLOT: 1 PORT: 1 DIN 9 - 16 RACK: 1 SLOT: 1 PORT: 9 DIN 609 - 616 RACK: 85 SLOT: 21 PORT: 1 DIN 617 - 624 RACK: 85 SLOT: 21 PORT: 9 DIN 625 - 632 RACK: 85 SLOT: 21 PORT: 17 DIN 633 - 640 RACK: 85 SLOT: 21 PORT: 25 DIN 641 - 648 RACK: 85 SLOT: 21 PORT: 33 DIN 649 - 656 RACK: 85 SLOT: 21 PORT: 41 DIN 657 - 664 RACK: 85 SLOT: 21 PORT: 49 DIN 665 - 672 RACK: 85 SLOT: 21 PORT: 57 DIN 673 - 680 RACK: 85 SLOT: 21 PORT: 65 DIN 681 - 688 RACK: 85 SLOT: 21 PORT: 73 DIN 689 - 696 RACK: 85 SLOT: 21 PORT: 81 DIN 697 - 704 RACK: 85 SLOT: 21 PORT: 89 DIN 705 - 712 RACK: 85 SLOT: 21 PORT: 97 DIN 713 - 720 RACK: 85 SLOT: 21 PORT: 105 DIN 721 - 728 RACK: 85 SLOT: 21 PORT: 113 DIN 729 - 736 RACK: 85 SLOT: 21 PORT: 121 DOUT[ 1] IN AUTO DOUT[ 2] IN HOME POS. DOUT[ 3] CYCLE COMPLETE DOUT[ 4] ROBOT ESTOP DOUT 1 - 8 RACK: 1 SLOT: 2 PORT: 1 DOUT 569 - 576 RACK: 85 SLOT: 21 PORT: 1 DOUT 577 - 584 RACK: 85 SLOT: 21 PORT: 9 DOUT 585 - 592 RACK: 85 SLOT: 21 PORT: 17 DOUT 593 - 600 RACK: 85 SLOT: 21 PORT: 25 DOUT 601 - 608 RACK: 85 SLOT: 21 PORT: 33 DOUT 609 - 616 RACK: 85 SLOT: 21 PORT: 41 DOUT 617 - 624 RACK: 85 SLOT: 21 PORT: 49 DOUT 625 - 632 RACK: 85 SLOT: 21 PORT: 57 DOUT 633 - 640 RACK: 85 SLOT: 21 PORT: 65 DOUT 641 - 648 RACK: 85 SLOT: 21 PORT: 73 DOUT 649 - 656 RACK: 85 SLOT: 21 PORT: 81 DOUT 657 - 664 RACK: 85 SLOT: 21 PORT: 89 DOUT 665 - 672 RACK: 85 SLOT: 21 PORT: 97 DOUT 673 - 680 RACK: 85 SLOT: 21 PORT: 105 DOUT 681 - 688 RACK: 85 SLOT: 21 PORT: 113 DOUT 689 - 696 RACK: 85 SLOT: 21 PORT: 121

When I check the I/O Digital configuration, it shows:

# RANGE RACK SLOT START STAT. 1 DI[1-16] 1 1 1 ACTIV 2 DI[17-512] 0 0 0 UNASG

# RANGE RACK SLOT START STAT. 1 DI[1-8] 1 1 1 ACTIV 2 DI[9-512] 0 0 0 UNASG

(No range above 512).

So, how do I delete or update the assignments?

bad assignment error

  • June 29, 2017 at 7:12 PM

To delete an assignment just go to your I/O config screen, cursor onto the line of the assignment you want to delete, press the DELETE button(above F4 i believe), and then press YES. I just did this in Roboguide to confirm the steps, but this was an R30iB controller so the steps or buttons might be a little different in the older R-J3iB controller.

I also use the SUMMARY.DG file alot. If I get a call about an issue with a robot I usually look there first in a robot's backup to get a good overview of the robot; IO config, options installed, software version, etc.

  • June 29, 2017 at 8:06 PM

Did you try to perform Cold Start of the controller ?

  • June 29, 2017 at 8:18 PM

Also you can clear ALL I/O assignment by going to:

MENU -> I/O -> Link Device

and than form softkeybar menu choose option CLR_ASG, than confirm that you want to clear ALL assignment and after this is done restart the controller.

But be aware this will clear ALL I/O , that means you need to set them again after restarting the robot. In your case it's not so many just one assignment.

  • June 30, 2017 at 1:50 PM
Quote from K-Sky To delete an assignment just go to your I/O config screen, cursor onto the line of the assignment you want to delete, press the DELETE button(above F4 i believe), and then press YES. I just did this in Roboguide to confirm the steps, but this was an R30iB controller so the steps or buttons might be a little different in the older R-J3iB controller. I also use the SUMMARY.DG file alot. If I get a call about an issue with a robot I usually look there first in a robot's backup to get a good overview of the robot; IO config, options installed, software version, etc.

The address range listed (in the SUMMARY.DG file) for Rack 85, Slot 21 is not listed in the IO config, so I can't delete it (I tried).

Quote from ownagebyh4x Did you try to perform Cold Start of the controller ?

Many times.

Quote from ownagebyh4x Also you can clear ALL I/O assignment by going to: MENU -> I/O -> Link Device and than form softkeybar menu choose option CLR_ASG, than confirm that you want to clear ALL assignment and after this is done restart the controller. But be aware this will clear ALL I/O , that means you need to set them again after restarting the robot. In your case it's not so many just one assignment.

I'll try this next week when the line is not running.

  • June 30, 2017 at 3:54 PM

Remember that I/O changes require a robot restart.....

  • June 30, 2017 at 4:40 PM
Quote from tony gast Remember that I/O changes require a robot restart.....

Is that a Cold Start on the controller or just cycling the power to it?

  • June 30, 2017 at 4:49 PM

You can just cycle power

  • July 3, 2017 at 8:24 AM

I would first try to set the number of digital IOs to 1024 (controlled start -> PROGRAM SETUP Menu) and then, after a cold start, try to delete the assignments. You can set the number if IOs back to 512 when you're done. Also, check analog signals for any non-zero configuration (Rack/Slot/StartPt).

  • July 4, 2017 at 2:57 PM
Quote from bidzej I would first try to set the number of digital IOs to 1024 (controlled start -> PROGRAM SETUP Menu) and then, after a cold start, try to delete the assignments. You can set the number if IOs back to 512 when you're done. Also, check analog signals for any non-zero configuration (Rack/Slot/StartPt).

Thanks bidzej. Unfortunately, my controller didn't have a menu under the Controlled Start to allow a Setup as you mentioned. BUT, because of what you mentioned, I was able to find a Variable under System/Variables called $MAX_DIG_PRT that I could set to 1024 (was 512). I did a Cold Start, deleted the I/O configuration that was assigned to the non-existant ControlNet boards, changed the variable back to 512, cold start and voila! NO BAD I/O rack assignment alarms anymore. Did this to both my robots and now I'm happy.

Thanks bidzej and to everyone with their suggestions.

Advertising from our partners

bad assignment error

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

zsh: inconsistent error handling in assignments

This is zsh -f :

Why is local messing up error handling?

  • variable-substitution
  • process-substitution

HappyFace's user avatar

From the zsh manual regarding the typeset builtin (which local is a special case of):

Unlike parameter assignment statements, typeset 's exit status on an assignment that involves a command substitution does not reflect the exit status of the command substitution. Therefore, to test for an error in a command substitution, separate the declaration of the parameter from its initialization: # WRONG typeset var1=$(exit 1) || echo "Trouble with var1" # RIGHT typeset var1 && var1=$(exit 1) || echo "Trouble with var1"

In your case:

Kusalananda's user avatar

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged zsh variable variable-substitution process-substitution ..

  • The Overflow Blog
  • Masked self-attention: How LLMs learn relationships between tokens
  • Deedy Das: from coding at Meta, to search at Google, to investing with Anthropic
  • Featured on Meta
  • User activation: Learnings and opportunities
  • Preventing unauthorized automated access to the network

Hot Network Questions

  • What is the average result of rolling Xd6 twice and taking the higher of the two sums?
  • How to Organise/Present Built Worlds?
  • Showing that a ball is a convex set
  • Why are METAR issued at 53 minutes of the hour?
  • Where is this NPC's voice coming from?
  • Can one freely add content to a quotation in square brackets?
  • After rolling a die 10 times, what is the probability that the sequence of rolls is non-decreasing?
  • Five Hundred Cigarettes
  • Since mathematicians are physical beings, does this mean that mathematics ultimately reduces to physics?
  • Prove that of all triangles having same base and equal areas, the isosceles triangle has the least perimeter.
  • How can I write A2:A and not get any results for empty cells
  • Remove an entire inner list that has any zeros
  • How can I reduce server load for a WordPress website with a large number of visitors without upgrading hosting?
  • How can I award a player an additional Feat?
  • All of them in order
  • How does Linux kernel use Intel SGX (Software Guard Extensions)?
  • Is there a fast/clever way to return a logical vector if elements of a vector are in at least one interval?
  • nicematrix \midrule undefined
  • Can I redeem myself with a better research paper if my thesis sucks?
  • Book where the humans discover tachyon technology and use this against a race of liquid metal beings
  • Java class subset of C++ std::list with efficient std::list::sort()
  • How many natural operations on subsets are there?
  • How does a rotating system behave as mass varies?
  • How can I make a 2D FTL-lane map on a galaxy-wide scale?

bad assignment error

Meraki Community

  • Community Platform Help
  • Contact Community Team
  • Meraki Documentation
  • Meraki DevNet Developer Hub
  • Meraki System Status
  • Technical Forums
  • Security & SD-WAN

Meraki MX84 Error Bad IP assignment configuration

  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Printer Friendly Page

Niraj

  • Mark as New
  • Report Inappropriate Content
  • All forum topics
  • Previous Topic

DarrenOC

  • New September 26: Cisco Learning Network EOL October 23, 2024
  • September 20: Community Platform Update: Wider content!
  • September 17: New survey – we want to hear from you! (and give you a chance to win swag!)
  • 3rd Party VPN 167
  • Auto VPN 314
  • Client VPN 440
  • Firewall 629
  • Community guidelines
  • Cisco privacy
  • Khoros privacy
  • Terms of service

SC2276 – ShellCheck Wiki

This is interpreted as a command name containing = . bad assignment or comparison, problematic code:, correct code:.

ShellCheck found a command name containing an unquoted equals sign = . This was likely intended as either a comparison or an assignment.

To compare two values, use e.g. [ "$var" = "42" ]

To assign a value, use e.g. var="42"

Exceptions:

None, though you can quote the = to make ShellCheck ignore it: "$var=42" .

Related resources:

  • Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!

ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.

  • Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

  • Recent Discussions
  • 4.9K All Categories
  • 1.2K Help! with 1.x
  • 333 Workshop
  • 3K Help! with 2.0
  • 343 Chit-Chat

: bad expression: Invalid left-hand side in assignment

Dazakiwi38

[[Open door|Sorter1][$CurrentPos.LocEntry[3] = 5; $CurrentPos.LocWall[3] = 5; $Reset = true; $DoorOpened = true]]
Originally I did try that normal link code method and what i was trying to achieve wasn't working so i wrongly assumed that you couldn't have [] within the link|passage code because it uses them, i was assuming it wasn't passing the values.
// WRONG: The closing square bracket of the array touches the closing pair of the markup, making them ambiguous. [[Go where?|There][$list to ["A", "B"]]] // CORRECT: The closing square bracket of the array is separated from the closing pair of the markup by a space. [[Go where?|There][$list to ["A", "B"] ]]
  • Skip to main content
  • Skip to search
  • Skip to select language
  • Sign up for free
  • Remember language
  • Português (do Brasil)

SyntaxError: invalid assignment left-hand side

The JavaScript exception "invalid assignment left-hand side" occurs when there was an unexpected assignment somewhere. It may be triggered when a single = sign was used instead of == or === .

SyntaxError or ReferenceError , depending on the syntax.

What went wrong?

There was an unexpected assignment somewhere. This might be due to a mismatch of an assignment operator and an equality operator , for example. While a single = sign assigns a value to a variable, the == or === operators compare a value.

Typical invalid assignments

In the if statement, you want to use an equality operator ( === ), and for the string concatenation, the plus ( + ) operator is needed.

Assignments producing ReferenceErrors

Invalid assignments don't always produce syntax errors. Sometimes the syntax is almost correct, but at runtime, the left hand side expression evaluates to a value instead of a reference , so the assignment is still invalid. Such errors occur later in execution, when the statement is actually executed.

Function calls, new calls, super() , and this are all values instead of references. If you want to use them on the left hand side, the assignment target needs to be a property of their produced values instead.

Note: In Firefox and Safari, the first example produces a ReferenceError in non-strict mode, and a SyntaxError in strict mode . Chrome throws a runtime ReferenceError for both strict and non-strict modes.

Using optional chaining as assignment target

Optional chaining is not a valid target of assignment.

Instead, you have to first guard the nullish case.

  • Assignment operators
  • Equality operators
  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

Why I get "Invalid left-hand side in assignment"?

There is code:

I get this error:

Why "&&" is wrong?

  • ecmascript-6

Vala Khosravi's user avatar

  • are you missing if before the first set of parentheses? –  Dan O Commented Dec 1, 2017 at 3:32
  • 1 result[id] = list[id] should be result[id] === list[id] as it is a condition –  Aravind Commented Dec 1, 2017 at 3:33
  • @Aravind that is not correct. –  Pointy Commented Dec 1, 2017 at 3:38
  • @DanO "if" must not be important, because all logical operator in ( ), not { } –  Turar Abu Commented Dec 1, 2017 at 3:43
  • @TurarAbu see my answer: the problem is that your assignment expression at the end of the && list is not in parentheses. –  Pointy Commented Dec 1, 2017 at 3:43

2 Answers 2

The problem is that the assignment operator, = , is a low-precedence operator, so it's being interpreted in a way you don't expect. If you put that last expression in parentheses, it works:

Pointy's user avatar

  • The real problem is using logical operators for control flow. –  user8897421 Commented Dec 1, 2017 at 3:50
  • 1 @rockstar well sure :) But it's not erroneous and lots of hard-core library code does stuff like that, so people will see it in "respectable" places. –  Pointy Commented Dec 1, 2017 at 3:55

There seems to be a typo in your code:

result[id] = list[id] should be result[id] == list[id] or result[id] === list[id] (if you're doing a strict comparison)

m-ketan's user avatar

  • No. The code posted is using JavaScript logical short-circuiting operators to conditionally perform an operation. The change you suggest would make the code do nothing at all. –  Pointy Commented Dec 1, 2017 at 3:37
  • The trouble at 4'th line. –  Turar Abu Commented Dec 1, 2017 at 3:40
  • There's no way = is a short hand for == or === . They have different meanings altogether. I checked in my console and it worked fine when I changed it to result[id] == list[id] –  m-ketan Commented Dec 1, 2017 at 3:41
  • @m-ketan he wants to use the assignment operator ( = ). If the statement does not perform an assignment, the code is useless. –  Pointy Commented Dec 1, 2017 at 3:42
  • @Pointy Oh I see it now. –  m-ketan Commented Dec 1, 2017 at 3:44

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged javascript angularjs ecmascript-6 or ask your own question .

  • The Overflow Blog
  • Masked self-attention: How LLMs learn relationships between tokens
  • Deedy Das: from coding at Meta, to search at Google, to investing with Anthropic
  • Featured on Meta
  • User activation: Learnings and opportunities
  • Preventing unauthorized automated access to the network
  • Feedback Requested: How do you use the tagged questions page?

Hot Network Questions

  • MegaRAID device can't start in Windows, error code 10 I/O adapter hardware error has occurred
  • Story where the main character is hired as a FORTH interpreter. We pull back and realise he is a computer program living in a circuit board
  • Problems regressing y on x/y?
  • White (king and 2 bishops) vs Black (king and 1 knight). White to play and mate in 2
  • Informal "chats" with potential grad school advisors
  • Does this work for page turns in a busy violin part?
  • Prove that of all triangles having same base and equal areas, the isosceles triangle has the least perimeter.
  • If Voyager is still an active NASA spacecraft, does it have a flight director? Is that a part time job?
  • How does Linux kernel use Intel SGX (Software Guard Extensions)?
  • Matter made of neutral charges does not radiate?
  • Score the science points in 7 Wonders
  • Why is my Lenovo ThinkPad running Ubuntu using the e1000e Ethernet driver?
  • Letter of Recommendation for PhD Application from Instructor with Master Degree
  • Do we have volitional control over our level of skepticism?
  • If a 'fire temple' was built in a gigantic city, with many huge perpetual flames inside, how could they keep smoke from bothering non-worshippers?
  • Five Hundred Cigarettes
  • When does derived tensor product commute with arbitrary products?
  • Which ancient philosopher compared thoughts to birds?
  • Since mathematicians are physical beings, does this mean that mathematics ultimately reduces to physics?
  • Does copying files from one drive to another also copy previously deleted data from the drive one?
  • What are major reasons why Republicans support the death penalty?
  • How can I draw the intersection of a plane with a dome tent?
  • What is the role of this suffix for an opamp?
  • Switch or switches in the context of trains in American English? Is my assumption correct?

bad assignment error

IMAGES

  1. [Solved] "zsh: bad assignment" error in Linux

    bad assignment error

  2. Troubleshoot

    bad assignment error

  3. Common Causes of Assignment Failure in the University

    bad assignment error

  4. Top 5 Reasons Why Your Assignment Failed Miserably

    bad assignment error

  5. Writing Errors That Damage the Quality of Your Assignment

    bad assignment error

  6. How to Avoid Common Mistake in Assignment Writing

    bad assignment error

VIDEO

  1. me deciding to choose happiness and submit a bad assignment

  2. HOW DIFFERENT TYPES OF NURSES REACT WHEN THEY GET A BAD ASSIGNMENT

  3. me choosing peace and submitting a bad assignment instead of working on it more

  4. Bad ending #error

  5. Teachers, what has been the worst way a student has misinterpreted an assignment?

  6. Ipang

COMMENTS

  1. Command Line zsh bad assignment error when setting an Alias

    Open the file /Users/me/.zshrc [this is the file where you were trying to add the path for Python] Look for the line that is missing a '', and add that ''. [most likely it's going to be the line you added with Python], so look there first. Save your file and exit.

  2. Fixing "zsh: bad assignment" error in Linux

    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 ...

  3. .bash_profile: bad assignment

    Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand; OverflowAI GenAI features for Teams; OverflowAPI Train & fine-tune LLMs; Labs The future of collective knowledge sharing; About the company Visit the blog

  4. IPPS-A Update: PCS Updates, Assignment Errors and Solutions, HR Pro

    Adjusting the assignment start date instead of using the in-transit grid will cause the absence request to be out of sync with the assignment, and makes the in-transit grid unusable. You must manually adjust the absence requests before arriving the Soldier. Assignment Errors and Solutions Early Report.

  5. zsh: bad assignment

    Discover in depth solution to zsh: bad assignment in Shell programming language. Follow our expert step-by-step guidance in Shell to improve your coding and debugging skills and efficiency.

  6. Bad IP Assingment

    Usually, bad IP assignment is related to VLAN's on the ports where the AP's are plugged in or incorrectly configured DHCP to the AP's, however as they are set with Static IP's, I guess it's not DHCP. 0 Kudos

  7. Bad Data Assignment Error

    @mithun: Thanks for the reply.It helped me. As a quick fix, I ended up removing the sign reserved from the Input Table DML. We migrated the project from 2.15 and 3.12 .For 3.12, I have a .profile which has all the 3.12 specific parameters.

  8. (eval):15 bad assignment when using '=' as alias #523

    This is similar to #263 but I get a different error: (eval):15: bad assignment As a result, all plugin aliases are gone. I'm using the zsh calc plugin, which aliases the =. When I remove this plugin, I get no errors and got all plugin al...

  9. fix(emotty): fix bad assignment error #9714

    Standards checklist: The PR title is descriptive. The PR doesn't replicate another PR which is already open. I have read the contribution guide and followed all the instructions. The code follows the code style guide detailed in the wiki. The code is mine or it's from somewhere with an MIT-compatible license. The code is efficient, to the best of my ability, and does not waste computer resources.

  10. macos

    2. When I try to write a Zsh script on macOS Big Sur, Version 11.5.1, I noticed that it keeps failing to recognize my variables as variables. Instead, Zsh treats them as UNIX-like commands. In the screenshot linked above, I did the following on the Terminal application. Showed the contents of the simple Zsh shell script.

  11. PRIO-063 Bad I/O asg error. How to fix?

    Also you can clear ALL I/O assignment by going to:. MENU -> I/O -> Link Device. and than form softkeybar menu choose option CLR_ASG, than confirm that you want to clear ALL assignment and after this is done restart the controller.

  12. variable

    Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site

  13. JSLint Error Explanations

    In JSLint and JSHint the warning given has always been "Bad assignment" In ESLint the warning has always been "Invalid left-hand side in assignment" The situations that produce the warning have not changed despite changes to the text of the warning itself.

  14. Meraki MX84 Error Bad IP assignment configuration

    Hi Team, MX84 reflects error of "Bad IP assignment configuration" through Broadband link configuration as WAN. Please suggest for fixation of issue. Thanks, Niraj

  15. ShellCheck: SC2276

    Rationale: ShellCheck found a command name containing an unquoted equals sign =.This was likely intended as either a comparison or an assignment.

  16. Parameter assignment error

    i am also facing the same problem,,,,(The module has detected a parameter assignment error) this is what i get from my plc error,,,,,the problem my tag list start from (I40.0) but when i put that on the program it appears as (E40.0),,,,,How do i solve this? Suggestion; To thank ; Quote; Answer

  17. : bad expression: Invalid left-hand side in assignment

    It means you're terminating your expression in the middle of it, causing the string concatenation operators to be seen on the left-hand side of an expression (i.e. the " + 5; + bitthe semi-colon terminates the current expression, which starts a new expression with the string concatenation operator). You're also missing some quotes and string ...

  18. SyntaxError: invalid assignment left-hand side

    Invalid assignments don't always produce syntax errors. Sometimes the syntax is almost correct, but at runtime, the left hand side expression evaluates to a value instead of a reference, so the assignment is still invalid. Such errors occur later in execution, when the statement is actually executed. Function calls, new calls, super(), and this ...

  19. "Invalid assignment" error from == operator

    In PL/SQL, assigning a value to a variable is done with the := operator. Comparing two values is done with =.. In Java, assigning a value to a variable is done with the = operator. Comparing two values is done with ==, or a .equals() method in some cases.. You can do things like this:

  20. Why I get "Invalid left-hand side in assignment"?

    7. The problem is that the assignment operator, =, is a low-precedence operator, so it's being interpreted in a way you don't expect. If you put that last expression in parentheses, it works: for(let id in list)(. (!q.id || (id == q.id)) &&. (!q.name || (list[id].name.search(q.name) > -1)) &&. (result[id] = list[id]) ); The real problem is ...