Help make bash script mksh compatible

stormy

Active member
Jun 23, 2019
147
62
28
Hi everyone,

I have this script which runs inside /etc/profile.d/which2.sh

Code:
# Initialization script for bash and sh

which() {

  (alias && declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-dot --show-tilde $@

}

export -f which
It executes whenever the shell is loaded. On this particular computer the default shell is bash, but I'm using mksh for speed reasons. When opening the mksh shell I get an error: 'export: -f: unknown option'

Ideally I want to keep the functionality of this script, but make it mksh compatible while still working with bash.

Is this possible? Thanks
 

rpajarola

New member
Oct 13, 2020
4
3
3
I'd just try to make mksh not read this script, it's not like you need it (frankly, you don't need it for bash either since "which" is a builtin, so you could probably just rename that file to which2.sh.bak with no ill effects).

I'd also be curious what you're doing with your shell to notice a speed difference between any shell...
 
  • Like
Reactions: stormy

stormy

Active member
Jun 23, 2019
147
62
28
Thanks, you were right, didn't need it after all. Oh this is on a 32mhz computer, so bash takes like 5 seconds longer to open lol :)
 

About us

  • Silicon Graphics User Group (SGUG) is a community for users, developers, and admirers of Silicon Graphics (SGI) products. We aim to be a friendly hobbyist community for discussing all aspects of SGIs, including use, software development, the IRIX Operating System, and troubleshooting, as well as facilitating hardware exchange.

User Menu