[Linux] clean shell environment Linux

I faced an error when building yocto after source SDK yocto :

$ source setup-environment build-imx8qxpc0/
Error: The OE SDK/ADT was detected as already being present in this shell environment. Please use a clean shell when sourcing this environment script.

Sometimes you have some error with the current shell environment but you don’t want to exit and open a new shell.
To renew the shell environment in linux you should follow two steps below:

  1. Check which shell are you using by command:
     ~$ echo $0 | sed -r 's/-//'
      bash
     ==> you are using 'bash' shell
    

    or

     ~$ echo $0 | sed -r 's/-//'
     sh
     ==> you are using 'sh' shell
    
  2. Reset current shell (check from step 1) environment by command:
     ~$ env -i bash

    or

     ~$ env -i sh

Or one command:

 ~$ env -i `echo $0 | sed -r 's/-//'`

I hope it helps you 🙂

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments