Page 1 of 1

<SOLVED>Running a script from any directory?

Posted: Sat Jul 15, 2017 7:09 pm
by new_to_linux
Hello, I'm just starting out with Linux and I'm trying to write a simple script for initializing a program.

So far, this is what I've got and it executes fine:

#!/bin/bash
clear
cd /
cd home/albatros/Programs/pycharm/bin
./pycharm.sh

To execute it, I have to first go to the directory where the script is placed.

However, is there a way to execute it from any directory I'm currently working in?

Cheers and thanks for the help!

Re: Running a script from any directory?

Posted: Sat Jul 15, 2017 7:24 pm
by jimallyn

Re: Running a script from any directory?

Posted: Sun Jul 16, 2017 5:09 am
by Cosmo.
Create in your home the folder bin and move the script into it. After the next log in into your account this folder will be automatically added to the PATH.

Re: Running a script from any directory?

Posted: Sun Jul 16, 2017 4:01 pm
by new_to_linux
Great answers! Thanks for the help!