I have a bash script and I want to use a command in it, that I defined in my config.fish
like this:
alias setbg='feh --bg-fill'
However when I use the command in my bash script, I get:
setbg: command not found
How do I make fish aliases visible to bash scripts?
You don't.
Fish aliases are internal to fish only, and since bash and fish are incompatible it's not guaranteed you can source
them either.
However, fish doesn't actually have aliases, the alias
command is just a wrapper around defining functions, and unlike bash fish always reads its configuration.
So you can run fish -c 'setbg'
.
Alternatively you could make a file with aliases that works in both bash and fish. As long as you stick to the common subset like simple alias key='value'
that would work, but you couldn't use any incompatible expressions like even if
.