0

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
3
  • 1
    Aliases aren't expanded by default in non-interactive shells - consider using shell functions instead Commented Mar 25, 2023 at 16:22
  • @steeldriver How would I include the .bash_functions file, where the shell function RSYNC is written into if needed to do so? Commented Apr 15, 2023 at 6:17
  • 1
    You would source it - . "$HOME/.bash_functions" or (with existence checking) if [ -f "$HOME/.bash_functions" ]; then . "$HOME/.bash_functions"; fi Commented Apr 15, 2023 at 11:18

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.