unix - Errors in bash scripts -


i have couple of errors in script built in centos deployed unix. have shebang #!/bin/bash on top of scripts , execute script using bash myscript.sh

line in script:

 existing[0]="" 

error: existing[0]=: not found

line in script: not sure if -

while ifs='' read -r line || [[ -n "$line" ]]; 

or 1 -

if [[ $sftp_status != 0 ]]; 

error: syntax error @ line 118: `i=$' unexpected

line in script:

i=$((i + 1)) 

if have shebang line on top, can set execute permission , run script ./<scriptname>. dont need bash <scriptname>.

those syntax seems valid me , doubt if bash. try /bin/bash <scriptname> , see if helps.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -