Bash script convert for mksh?
#1
Bash script convert for mksh?
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. 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. If it is too difficult to make compatible with mksh perhaps I could put it in bashrc instead I wonder.

Is this possible? Thanks
stormy
Atari expert!

Trade Count: (1)
Posts: 180
Threads: 34
Joined: May 2019
Location: UK
Find Reply
01-04-2021, 08:59 PM


Messages In This Thread
Bash script convert for mksh? - by stormy - 01-04-2021, 08:59 PM
RE: Bash script convert for mksh? - by Raion - 01-04-2021, 09:51 PM
RE: Bash script convert for mksh? - by robespierre - 01-06-2021, 02:27 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)