Jacob Carlborg wrote: > On 2011-01-25 23:59, Jesse Phillips wrote: >> Jacob Carlborg Wrote: >> >>> Yeah, I guess you're right, didn't think there were a lot people who >>> used other shells. Since I almost know nothing about shell scripting and >>> even less about non-bourne shells, will it be possible to port to other >>> shells? How much do they differ? >>> >>> -- >>> /Jacob Carlborg >> >> To add to Lutger's message. I believe it is sh that is required by all >> Posix systems, or at least an equivalent. Similarly I think vi is also >> a requirement. >> >> In all likelyhood you probably used a Bash specific feature, but >> usually everyone has bash even if they use zsh... Though Ubuntu/Debian >> has started pointing /bin/sh to dash which is complaint with posix... > > Ok. I'll see I can use only sh. > You cannot. You need to modify the environment for the current shell, which is the shell that the user is currently using (no matter what else may or may not be installed on the system). This has two consequences:
- You need to have some code that is run when the shell starts (i.e. from .bashrc, .zshrc or .kshrc). That code will define the proper aliases and/or functions (at the time being, this is mostly the "dvm" function in "dvm.sh" (*)). This can be accomplished by having a different version of this file for each shell; - You need to generate the contents of $dvm_result_path in a format that the shell will understand. The easiest way to do that is probably to define a few extra functions in "dvm.sh" to enable setting environment variables in a portable way and handle additional requirements (like "builtin hash -r" which is definitely a bash-ism). Then generate the $dvm_result_path using these functions instead of the normal shell syntax. Jerome (*) BTW, I hope you do not add the full contents of dvm.sh nor a "source dvm.sh" in .bashrc the way it is now. Otherwise, a misconfiguration may prevent the user from starting a shell! -- mailto:jeber...@free.fr http://jeberger.free.fr Jabber: jeber...@jabber.fr
signature.asc
Description: OpenPGP digital signature