-1

I read a tutorial about how to add a folder to PATH. I added the below to the .bashrc file:

export PATH=/opt/aseprite/build/bin

When I tried to use source ./.bashrc from zsh I got this error

/home/luke/.bashrc:16: command not found: shopt
/home/luke/.bashrc:24: command not found: shopt
/home/luke/.bashrc:111: command not found: shopt
/usr/share/bash-completion/bash_completion:45: command not found: shopt
/usr/share/bash-completion/bash_completion:1512: parse error near `|'
\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$

Here is a link to my full .bashrc: https://pastebin.com/28RQV97K

What am I doing wrong with the PATH variable here?

1 Answer 1

7

Your problem is two-fold:

1. You overwrote the path specification

With your

export PATH=/opt/aseprite/build/bin

you have not added a folder to PATH, but overwritten it. Hence your bash cannot find any executables outside of /opt/aseprite/build/bin (unless you call them with absolute path).

What instead you should do is

export PATH="$PATH":/opt/aseprite/build/bin

This would append the new path to the existing content of the variable.

However, and more importantly:

2. You used the wrong configuration file

If you are using zsh, then the .bashrc is the wrong file to use for shell settings. The two shells are rather different in how they handle environment settings and what syntax to use, so you may not get the expected results even if the syntax is correct for the bash. The errors you show demonstrate how the zsh fails to apply bash-specific commands and settings, which would probably have worked fine had you sourced the file from a bash (in particular, shopt is a bash builtin command which zsh cannot know).

Instead, look at this question on how to add paths to zsh .

Fortunately, since you only sourced the .bashrc, the wrong settings will only take effect in the terminal where you ran that command, and opening a new console will give you a fresh start (since zsh doesn't automatically read your incorrectly modified .bashrc).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .