shell - Find out what version of BASH a script needs -


i wrote shell script uses few bash specific commands, such [[ ... ]]. know bash features available in bash 4 or newer. how can find out version of bash need script without trying numerous different versions?

is there kind of tool can check needed minimum version?

the source code available on github @ https://github.com/jeff-media-gbr/randomround/blob/master/randomround

there bunch of resources check a) introduction of specific bash feature , b) bashisms in general:

these can used figure out when feature introduced.

for list of bashisms, bash manual describes differences bourne shell in appendix b ("major differences bourne shell"), , there article how make bash scripts work in dash on wooledge wiki.

i don't know distribution of versions "in wild" is, if user base includes macos users, aware use bash 3.2 unless have upgraded using homebrew or similar.

as programmatically determining version of bash required run specific script, i'm not aware of tool that. shellcheck comes close in can warn bashisms when script starts #!/bin/sh.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -