I am trying to run a script like :
./script.sh file
but I am receiving ( if I use a txt file ):
=: cannot open `=' (No such file or directory)
test.txt: ASCII text
Second
If I use a gz file:
=: cannot open `=' (No such file or directory)
test.txt.gz: gzip compressed data, was "test.txt", last modified: Wed Jul 20 09:17:58 2016, from Unix
Second
( I have the script and the file in the same directory )
script:
#!/bin/bash
file = $1
if [[ $file == *.gz ]];then
echo "First"
else
echo "Second"
fi
=
– 123 Jul 20 '16 at 09:36