I am trying to run a script like :./script.sh filebut I am receiving ( if I use a txt file ):=:        cannot open `=' (No such file or directory)test.txt: ASCII textSecondIf 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 UnixSecond( I have the script and the file in the same directory )script:#!/bin/bashfile = $1if [[ $file == *.gz ]];then    echo Firstelse    echo Secondfi
cannot open file as first argument
shell script;scripting
file = $1runs the file command with = as the first argument and the result of the split+glob operator applied to the script's first parameter as the remaining arguments.Variable assignments in Bourne-like shells (like bash, ksh, zsh, ash/dash, yash) are with no spaces around the = sign:file=$1file = $1 would be valid as an assignment in rc, es or akanga shells. csh and tcsh have yet another syntax: set file = $1:q and fish uses set file $argv[1].