Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to run a script every time I open WSL Ubuntu 18.04 on Windows 10

Every time I open WSL Ubuntu 18.04 on Windows 10 I want to run these settings automatically.


    alias desktop='cd /mnt/c/Users/Dot/Desktop/ai_files'
    export PYTHONPATH=${PYTHONPATH}:${HOME}/ai-safety-gridworlds
    export DISPLAY=localhost:0.0

I tried making .sh script with the following content in /etc/init.d/ but it didn't work.


    #!/bin/bash
    alias desktop='cd /mnt/c/Users/Dot/Desktop/ai_files'
    export PYTHONPATH=${PYTHONPATH}:${HOME}/ai-safety-gridworlds
    export DISPLAY=localhost:0.0

like image 436
Rogster Avatar asked Sep 02 '25 11:09

Rogster


1 Answers

To run these commands every time you open WSL, you will want to append the commands to .bashrc. In bash, run

echo "alias desktop='cd /mnt/c/Users/Dot/Desktop/ai_files'" >> ~/.bashrc
echo "export PYTHONPATH=${PYTHONPATH}:${HOME}/ai-safety-gridworlds" >> ~/.bashrc
echo "export DISPLAY=localhost:0.0" >> ~/.bashrc
like image 158
Ross Douglas Avatar answered Sep 06 '25 02:09

Ross Douglas