Bash aliases only for toolboxes

Hello everyone, I’m running Fedora Workstation 41 with a Ubuntu toolbox for Quartus Prime.

I’ve had some issues programming my FPGA from the GUI and resorted to CLI programming which worked great.

only problem is the size of the command to enter:

./quartus_pgm -c usb-blaster -m JTAG -o "p;/home/mathis/Documents/Cours/VL/VHDL/Exercices/AG_01/output_files/AG_01.sof"

So i tried to see if there was a way to use an alias but only in the toolbox.
I came up with this which works:

alias quartus_pgm='env --chdir=/home/mathis/intelFPGA_lite/20.1/quartus/bin/ ./quartus_pgm'

When looking on a way to do something similar to bashrc.d, I found this reddit post which sadly didn’t work.
Could you please help me?

You can put aliases in your ~/.bashrc.

What I do for this sort of thing is write a shell script and then run that script.
I will often commit the helper script as one of my project sources files in git.

in my .basrc on the workstation I did put:

if [ -f /run/.toolboxenv ]; then
    # aliases for container
    alias testing=ls
fi

restarting local terminal and also restarting the toolbox.
And it works.

2 Likes

Ok thanks, does the other solution with the container name works? I used this one so that could be why.

If you wanted to do container names something like the below should work:

if [ -f "/run/.toolboxenv" ]
        then
        TOOLBOX_NAME=$(cat /run/.containerenv | grep -E '^name="' | cut -d \" -f 2)
        echo "${TOOLBOX_NAME}"
        case "${TOOLBOX_NAME}" in
                fedora-toolbox-42)
                        echo "fedora42";;
                *);;
        esac
fi
1 Like