Hi I\'m new to bash scripting. Just wrote this simple program but it is throwing error.
#!/bin/bash
os=`uname -o`
echo $os
if [\"$os\"==\"GNU/Linux\"] ; then
Use =
for string comparison. See: http://tldp.org/LDP/abs/html/comparison-ops.html
Also, there should be a space around the square brackets and the comparison operator, i.e.
if [ "$os" = "GNU/Linux" ]; then
^ ^ ^ ^ ^
| | | | |
\-\-----\-\-----------\-- (need spaces here)
try
if [ "$os" = "GNU/Linux" ]
note the spaces, and the single =
.
[
is actually a program, and the rest are arguments!