Inheriting aliases inside UNIX /usr/bin/script Inheriting aliases inside UNIX /usr/bin/script shell shell

Inheriting aliases inside UNIX /usr/bin/script


It works OK when I start it under bash. Maybe there's something in your zsh configuration that's mucking it up, or it's not sourcing your zsh's startup files. You could try:script -c zsh

Which may force it to start a new zsh shell and have it source your zsh config files.


An alias isn't an environment variable. You could source your .profile or where ever you set up the alias. Also take a look at the $SHELL environment variable.

The script command isn't terribly complicated. It wouldn't be too difficult to replicate and make it work the way you expect.


As noted by Jon Ericson, aliases are not part of the environment. You will find all your environment in your script.

To get all your aliases in the script, you can save them in a file then reload them:

    $ alias myls="ls -lCF"    $ alias -L >/tmp/alias.zsh    $ script    $ . /tmp/alias.zsh    $ myls

If you put your aliases in a file called .zshrc in your home directory it will automatically be loaded.