I want to check if tmux alias exists, when I run command in terminal:
$ type -t tmux
the result is
$ alias
But when I put "type -t tmux" in a shell script and run, the result is
$ ./test.sh
$ file
Why the result is different ?
My test.sh is:
#!/usr/bin/env bash
set -e
type -t tmux
Any aliases defined in .bash_profile
should be read and respected by tmux, but does not read anything in .bashrc
.
Invoking test.sh is a sub-process, and does not use environment from current process unless you source it source test.sh
but that also allows that script to modify current environment.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.