works:
#!/bin/bash
if [ $BASH_VERSION = "4.4.12(1)-release" ] ; then
echo "BASH VERION: 4.4.12(1)-release detected"
fi
doesn't work:
#!/bin/bash
if [$BASH_VERSION = "4.4.12(1)-release"] ; then
echo "BASH VERION: 4.4.12(1)-release detected"
fi
explain yourselves bashtards.
>>61062712
[ is the name of a binary
[$BASH_VERSION is not
Bash is not a programming language, stop using it as such.
>>61062780
by binary, do you mean a boolean value, or an executable?
>>61062861
An executable$ whereis [
[: /usr/bin/[ /usr/share/man/man1/[.1.gz
"[" is actually a program, it's alias for "test", would recommend watching
https://www.youtube.com/watch?v=olH-9b3VJfs
(website http://shellhaters.org/)
>>61063133
>>61063187
thx guys.. sorry i called you bashtards
>>61062712
it works on my machine#!/bin/bash
if [ $BASH_VERSION = "4.4.12(1)-release" ]
then
echo "BASH VERION: 4.4.12(1)-release detected"
fi
>>61063133>>61062780
That's incorrect though. The command [ calls a bash builtin normally.
>>61063469
the key to getting it to fail is removing the whitespace after the [
i watched this --->>>61063187
it cleared it up very well.
>>61063187
21:17
C-x C-e
Ho my gosh, i didn't know that trick. I didn't regret watching that video.
>>61062780
what the fuck, I never knew that. maybe because I avoid bash at all costs
>>61063518
[[ is a bash builtin. [ is an executable.