goelakash
goelakash

Reputation: 2519

Add a command for bash script to terminal

I have studio.sh file in my android-studio/bin folder, which I would like to use as a command in bash (like launching any other normal application).

I read somewhere that adding this line to ~/.profile should work,

export PATH=$PATH:/home/goel/android-studio/bin

But it doesn't work. Whats the correct process?

Upvotes: 1

Views: 2329

Answers (3)

user4454229
user4454229

Reputation:

Is studio.sh executable? Have you tried ./studio.sh inside its containing folder to check whether it runs at all?

Upvotes: 0

vkumar
vkumar

Reputation: 169

Add the script folder name to PATH environment variable in ~/bash.rc file and you can also create alias for you script in ~/bash.rc and source the /etc/bash.bashrc file, now you can issue your script or alias name in any terminal. Hope this helps.

Upvotes: 2

choroba
choroba

Reputation: 241788

If you change your PATH in a .profile, you still have to make the shell read the .profile. Starting a new terminal is sometimes not enough (some terminals don't read the .profile), in which case you have to log out and back in.

Upvotes: 0

Related Questions