1

I use a Lubuntu 16.04

This morning I started getting this message in terminal whenever I open a new terminal bash: [: /home/timi95/workspace/WEB_TECHNOLOGIES/Angular: binary operator expected , I'm not sure what's wrong and I've tried a tset,reset , sudo updates etc.

There doesn't even exist a file or folder called 'Angular' in the path specified.

Any clues on what might be happening or how to fix this ?

The last thing I remember installing aside from updates, was electron-forge. I was considering cross-platform desktop app tools. Do you think that has anything to do with this ?

  • 1
    This means there has to be an error in one of the if statements or statements that use [ , inside either ~/.bashrc or one of the files that get sourced by it. Open the file in gedit or other text editor and go through the file. Specifically look for variables related to Angular - that's already suggested by the output – Sergiy Kolodyazhnyy Jan 5 at 10:54
  • As for whether there's anything to do with updates/installationis - yes it is possible. Certain applications take liberty of appending configurations to user's ~/.bashrc, such as modifying the $PATH variable or exporting extra variables among other things. – Sergiy Kolodyazhnyy Jan 5 at 10:55
  • @SergiyKolodyazhnyy yes I think you are right. I saw these lines : # tabtab source for electron-forge package # uninstall by removing these lines or running tabtab uninstall electron-forge` [ -f /home/timi95/workspace/WEB_TECHNOLOGIES/Angular projects/test-forge-project/node_modules/tabtab/.completions/electron-forge.bash ] && . /home/timi95/workspace/WEB_TECHNOLOGIES/Angular projects/test-forge-project/node_modules/tabtab/.completions/electron-forge.bash` and the seem to be missing a ']' . If I add that bracket and then reset terminal , is my issue resolved or is there more to it ? – timi95 Jan 5 at 11:33
  • @SergiyKolodyazhnyy Thanks I fixed it, it was the trailing ']' and a couple of un-escaped spaces. Thank you very much !. – timi95 Jan 5 at 11:43
  • well, I have just posted an answer about it, but yes, the escaping or quoting is the solution. Congrats on resolving it ! – Sergiy Kolodyazhnyy Jan 5 at 11:44
2

In your error message you have

/home/timi95/workspace/WEB_TECHNOLOGIES/Angular

however in the comments you've mentioned the line

/home/timi95/workspace/WEB_TECHNOLOGIES/Angular projects/test-forge-project/node_modules/tabtab/.completions/electron-forge.bash

Notice the space between Angular and projects. This is the core of the issue.

In [ command ( and yes, that's a command also known as test, not just a bracket ) the -f operator expect a single argument after it. The space makes the line appear as if there are two arguments after -f. Thus, the issue should be fixed via either quoting the path or by escaping the space with backslash as in

/home/timi95/workspace/WEB_TECHNOLOGIES/Angular\ projects/test-forge-project/node_modules/tabtab/.completions/electron-forge.bash

Spaces in command line serve as word separators, and if they are not escaped or quoted the shell will treat the line as more words than wht you intended. Among other things, this is also one of the reasons why you should quote variables - without double quotes word splitting on whitespace, newline, or tab (because such is the default value of IFS variable which shell consults for word splitting) will be applied.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.