Either method should work, as far as I can tell. If you go with option 1, however, you should:
Make the script file executable. As a reminder, you can use the following terminal command to do this:
chmod +x ~/xgamma.sh
When you add the script as a startup program, specify the full path to the script -- so instead of typing ~/xgamma.sh into the "Command" field, type /home/[username]/xgamma.sh. If your username is mickee, type /home/mickee/xgamma.sh.
or, the default file for personal executables is /home/mickee/bin or /home/mickee/.local/bin if you want it hidden for some reason. If either of those directories exists, it is automatically added to your $PATH when .profile runs
or, you can call the script locally with a fully specified pathname: e.g.:
$ /home/mickee/scripts/xgamma.sh -OR-
$ ~/scripts/xgamma.sh -OR-
$ (from the scripts directory only) $ ./xgamma.sh
@tatanka I think you may be misreading what he is doing. It looks like he has it working from startup scripts (solved) but had a followup question about running the script from its own directory. The only place he has ~/ is in his terminal prompt; he only typed "xgamma.sh"
He doesn't realize that unlike other OSs Unix/Linux does not automatically include the current directory in the $PATH.
Permanently Add A Directory To $PATH
To add a directory to $PATH permanently, we’ll need to edit the .bashrc file of the user you want to change.
Use nano or your favorite text editor to open the file, stored in the home directory.
$ pluma ~/.bashrc
At end of this file, put your new directory that you wish to permanently add to $PATH
export PATH=”/home/mendy/myscripts:$PATH”
Save your changes and exit the file. Afterwards, execute the following command to make the changes take
effect in your current session. Alternative, you can log out or reboot the system.
$ source ~/.bashrc
That’s all there is to it. You can check $PATH once more to verify the change.
$ echo $PATH
Temporarily Add A Directory To $PATH
To add a directory to $PATH for the current session, use the following command syntax. In this example, we’re
adding the /home/mendy/myscripts directory.
$ export PATH=”/home/mendy/myscripts:$PATH”
You can verify afterwards that the directory has been added.
$ echo $PATH
/home/mendy/myscripts [...]
Now, files we have stored in the /home/mendy/myscripts directory can be executed anywhere, without specifying their
full path. This configuration will change when we end the current session (reboot the PC or close the
terminal). To make it permanent, check out the section above.
Image shows result of using permanent method adding path to my folder with my scripts in it.
Just a point to make, though. Adding to .bashrc only adds to path when using the bash shell. Any scripts using other shells will not have that path. Adding to .profile affects all login shells.
That may be exactly what one wants, or it may cause confusion because the $PATH is different depending on how it is invoked.
As @gordon implies, though, startup commands does not invoke a login shell until the script's first line is read, so you have to use the full pathname there regardless. And there are security implications to consider when adding multiple directories to $PATH
This topic has been marked "solved," so I'm only adding this for consideration. If you want to start a process when the computer starts and you can't craft a service script for it, you can use a cron job with the @reboot option. The syntax, depending on your environment, looks something like this: