I have two scripts in the same directory:
latlong.sh
#!/bin/sh
set latlong 'x.xxxxxx:x.xxxxxx'
autostart_once.sh
#!/bin/sh
. ./latlong.sh
# some start up commands
redshift-gtk -l $latlong -t 6500:3600 &
However, running autostart_once.sh
above will yield an error. It seems like even after sourcing the latlong script the latlong
variable is still empty (I have made sure the working directory is where latlong.sh is). However if I run . ./latlong.sh
in a terminal running a fish shell and then echo $latlong
the variable is set correctly. What could be happening here?
A few things:
- I don't want to be able to access the variable outside the autostart script.
- The reason why I am putting the latlong variable to another file is that I encrypt that file before pushing it to a dotfiles repository, but I do not want to encrypt the startup file so that other people can use it as well.