[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
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
사설토토
사설토토
2 months ago

Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but https://codehillacademy.com