Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
6

How to add current working directory to the PATH environment variable

ashokb
ashokb

I am compiling multiple executables.
And I want to be able to execute it when I am in the current working directory.
How to add the CWD to the environment PATH variable?

I have .bashrc and within it I have:
export PATH=/home/runner/Unit5Programs:$PATH

But it gets reset every time I press the "Run" button. How to make this work?

3 years ago

Voters

Comments

TopNew
2
isbur
isbur

Hi! I found a somewhat sneaky solution to this issue. It uses a comparatively recent Secrets feature. Yes, just put desired PATH contents to secret named "PATH", for example, you can echo default PATH contents and than copy it cocatenating with your own paths.

However, some system-wide settings affecting PATH value may be changed later, and as this solution is basically forcible rewriting of PATH variable you may need to manually update the "secret" according to changes that took place.

1 year ago
1
lutzhamel
lutzhamel

@isbur
Interesting way of approaching this. However, the problem is when you clone the VM the secrets are not carried forward to the clone and the clone is left in a non-working state which I think completely breaks the vision and purpose of REPLs...

1 year ago
Load more