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!
<SOLVED>Running a script from any directory?
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
<SOLVED>Running a script from any directory?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Running a script from any directory?
These should clear it up for you:
http://www.linfo.org/path_env_var.html
https://stackoverflow.com/questions/146 ... h-on-linux
https://opensource.com/article/17/6/set-path-linux
http://www.linfo.org/path_env_var.html
https://stackoverflow.com/questions/146 ... h-on-linux
https://opensource.com/article/17/6/set-path-linux
“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan
Re: Running a script from any directory?
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.