I'm using two commands in a file executed by my .config/openbox/autostart.sh which are also aliased in my .bash_alises and one of them changes from time to time. The thing is that I also use these commands aliases in my .bash_aliases and changing all files with every change in every same way is quite annoying.
I'd like to have my aliases been known by the Openbox autostart file.
My .config/openbox/autostart.sh (mainly)
. $GLOBALAUTOSTART
lxterminal -e "$(cat ~/.config/openbox/terminal.sh)" # command for a clean autostart file
My .config/openbox/terminal.sh
a="b"
while [[ -n "$a" ]]; do
read a
if [[ "$a" =~ "o" ]] || [[ "$a" =~ "O" ]]; then
sudo mount -t davfs example.com/webdav ~/exampleCom
rsync -giloprtu --specials exampleCom/dir0/ dirs/directory_0
rsync -giloprtu --specials exampleCom/dir1/ dirs/directory_1
sudo umount exampleCom
fi
[…]
done
My .bash_aliases
alias RS='rsync -giloprtu --specials'
alias RSYNC='sudo mount -t davfs example.com/webdav ~/exampleCom
RS exampleCom/dir0/ dirs/directory_0
RS exampleCom/dir1/ dirs/directory_1
sudo umount exampleCom'
Desired .config/openbox/terminal.sh
a="b"
while [[ -n "$a" ]]; do
read a
if [[ "$a" =~ "o" ]] || [[ "$a" =~ "O" ]]; then
RSYNC # read from my ~/.bash_aliases
fi
[…]
done
.bash_functionsfile, where the shell functionRSYNCis written into if needed to do so?. "$HOME/.bash_functions"or (with existence checking)if [ -f "$HOME/.bash_functions" ]; then . "$HOME/.bash_functions"; fi