Shell Aliases

I have a specific set of shell aliases that I need. Is there a way to make FVWM read these on startup so they will be available to me? I have set ExecUseShell /bin/zsh already. I cannot for the life of me figure this out. Thank you.

Use them where? Accessing shell alises from things like terminals is a facet for how you manage your shell. For instance, most terminals have an “-ls” option to force a login shell. This might be want you want to do, although that’s per-terminal dependant, i.e., the encapsulating environment isn’t global.

If you wanted that, you would have to source ~/.zsh{rc,env} in something like ~/.x{initrc,session} depending on how you start FVWM. Although that won’t help you, since aliases should be interactive shell based, and not something you can use outside of that.

– Thomas Adam

Sorry about the confusion. I should have been a little clearer, althought I Do appreciate the quick response.

I have certain aliases set in my .zshrc file:

alias ‘get-do’=‘rsync -azv rsync://gatsby:2222/Website/ /files/Projects/Websites/do.com/ --stats’
alias ‘sync-do’=‘rsync -azv /files/Projects/Websites/do.com/ rsync://gatsby:2222/Website/ --stats’
alias poker=’$HOME/Custom/rdesktop/bin/rdesktop -P -B 192.168.1.104 -g 1280x800 -r sound:local -X lan’

I want to be able to exucute these commands via a Popup menu entry. When I try the Poker menu entry, it says zsh: command poker not found

You can’t. You would need to use a function since aliases are for interactive shells only. And even then this is still a kludge. Let’s use one of your examples:

alias 'get-do'='rsync -azv rsync://gatsby:2222/Website/ /files/Projects/Websites/do.com/ --stats'

If you wanted to run this alias from a menu in FVWM, you need two things:

  1. A shell with an evaluated ~/.zshrc to maintain locally-scoped environment.
  2. A controlling TTY most likely. Say, xterm.

Now, in your case, you would then have to add in ~/.zshrc:

function f-get-do()
{
    get-do
}

Which would then call your alias. If you then tried the following from FvwmConsole:

Exec xterm  -hold -e 'zsh -c ". ~/.zshrc && f-get-do"'

You will see (hopefully) some output in the shell. I’ve use “-hold” to xterm to keep it around. You could also argue that you don’t need to evaluate ~/.zshrc each time, if you source it only once from ~/.x{session,init} but for a variety of reasons this isn’t always appropriate, or applicable. Indeed, it has to be this way in case the implicit login shell spawned from the terminal clobbers it.

Either way, what you’re trying to do is very wrong. Consider writing proper shell scripts.

– Thomas Adam