linuxunixgnu-toolchain

Error in setting the path variable in Linux


I would like to set a path to the Gnu toolchain downloaded from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads. I used the line $PATH=$HOME/Toolchains/gcc-arm-none-eabi-9-2020-q2-update/bin:$PATH to set the path in the terminal. For the first time, I was able to change the path, then I closed the terminal and again set the (wrong) path $PATH=/home/paulson/Toolchains/gcc-arm-none-eabi-9-2020-q2-update/bin:$PATH. Now I am unable to set the correct path and the terminal shows as below.

paulson@debian:~/Toolchains$ 

paulson@debian:~/Toolchains$ ls
gcc-arm-none-eabi-9-2020-q2-update

paulson@debian:~/Toolchains$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

paulson@debian:~/Toolchains$ $PATH=$HOME/Toolchains/gcc-arm-none-eabi-9-2020-q2-update/bin:$PATH
bash: /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games=/home/paulson/Toolchains/gcc-arm-none-eabi-9-2020-q2-update/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games: No such file or directory


Solution

  • If you want to set the path environment variable, you need to use: export PATH=/some/path:$PATH.

    In your case, it would look like: export PATH=$HOME/Toolchains/gcc-arm-none-eabi-9-2020-q2-update/bin:$PATH The only downside to setting the path manually is that it will not persist across bash sessions. If you want this change to be permanent, then I would suggest adding that line to your .bashrc or .profile file in the home directory.