Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code use alias from ~/.bashrc in task.json

I alias the path of my cross compiler in my linux system. Now I want use that alias in my task.json of VS Code. So I write this snippet:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Test",
            "type": "shell",
            "linux": {
                "command": "My_gcc"
            },
        }
    ]
}

But I got this

Error 127: Command "My_gcc" not found

Why do I get this error?

like image 773
Kampi Avatar asked Sep 15 '25 11:09

Kampi


1 Answers

Just alter your task as follows: "command": "source ~/.bash_profile && My_gcc"

This will make it source ~/.bash_profile into scope before trying to use your alias.

like image 68
Bryce Avatar answered Sep 18 '25 09:09

Bryce



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!