Setting $ANDROID_SDK_ROOT on fish shell from bash shell equivalence

Issue

I’m trying to set $ANDROID_SDK_ROOT for fish shell in config.fish, I previously had the configuration set on my previous linux installation which used bash as follows:

export ANDROID_SDK_ROOT=$HOME/Library/Android/Sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools

But now I want to set it for my new Garuda Linux installation which uses Fish shell. The above configuration does not work. I tried the following configuration and I’m not sure if it’s correct:

set -x ANDROID_SDK_ROOT $home/Android/Sdk
set -x PATH $PATH $ANDROID_SDK_ROOT/emulator
set -x PATH $PATH $ANDROID_SDK_ROOT/platform-tools

Solution

You don’t want to set PATH $PATH /some/dir — that will add /some/dir again, regardless if it’s already in there.

Also, $HOME/Library/Android/Sdk not $home/Android/Sdk — this is probably the source of "does not work".

You want

set -x ANDROID_SDK_ROOT $HOME/Library/Android/Sdk
fish_add_path  $ANDROID_SDK_ROOT/emulator  $ANDROID_SDK_ROOT/platform-tools

https://fishshell.com/docs/current/cmds/fish_add_path.html?highlight=add

Answered By – glenn jackman

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published