-3

I Have Been Searching For Answers But I Can't Find Any So Here's My Code In "od -a"

LiamBogur@LIAMBOGUR:/mnt/c/Users/traci/Desktop$ od -a ethedit2.sh
0000000   #   !   /   b   i   n   /   b   a   s   h  nl   e   t   h   v
0000020   i   e   w   s   t   a   t   u   s   =   0  nl   e   t   h   v
0000040   i   e   w   m   o   d   e   =   0  nl   e   t   h   v   i   e
0000060   w   p   r   o   t   o   c   o   l   =   0  nl   w   h   i   l
0000100   e  sp   [  sp   $   e   t   h   e   d   i   t   s   t   a   t
0000120   u   s  sp   =  sp   1  sp   ]  nl   d   o  nl   i   f  sp   [
0000140  sp   $   e   t   h   e   d   i   t   m   o   d   e  sp   =  sp
0000160   0  sp   ]  nl   t   h   e   n  nl   i   f  sp   [  sp   $   e
0000200   t   h   e   d   i   t   p   r   o   t   o   c   o   l  sp   =
0000220  sp   0  sp   ]  nl   t   h   e   n  nl   n   c  sp   -   l  sp
0000240   -   v  sp   2   2   2   3  sp   |  sp   n   c  sp   l   o   c
0000260   a   l   h   o   s   t  sp   2   2   2   2  nl   f   i  nl   i
0000300   f  sp   [  sp   $   e   t   h   e   d   i   t   p   r   o   t
0000320   o   c   o   l  sp   =  sp   1  sp   ]  nl   t   h   e   n  nl
0000340   n   c  sp   -   l  sp   -   v  sp   -   u  sp   2   2   2   3
0000360  sp   |  sp   n   c  sp   l   o   c   a   l   h   o   s   t  sp
0000400   2   2   2   2  nl   f   i  nl   f   i  nl   i   f  sp   [  sp
0000420   $   e   t   h   e   d   i   t   m   o   d   e  sp   =  sp   1
0000440  sp   ]  nl   t   h   e   n  nl   i   f  sp   [  sp   $   e   t
0000460   h   e   d   i   t   p   r   o   t   o   c   o   l  sp   =  sp
0000500   0  sp   ]  nl   t   h   e   n  nl   n   c  sp   -   l  sp   -
0000520   v  sp   -   w   1   5  sp   2   2   2   1  sp   |  sp   e   t
0000540   h   e   d   i   t   i   p   =  nl   n   c  sp   -   l  sp   -
0000560   v  sp   2   2   2   2  sp   |  sp   n   c  sp   $   e   t   h
0000600   e   d   i   t   i   p  sp   2   2   2   3  nl   f   i  nl   i
0000620   f  sp   [  sp   $   e   t   h   e   d   i   t   p   r   o   t
0000640   o   c   o   l  sp   =  sp   1  sp   ]  nl   t   h   e   n  nl
0000660   n   c  sp   -   l  sp   -   v  sp   -   w   1   5  sp   2   2
0000700   2   1  sp   |  sp   e   t   h   e   d   i   t   i   p   =  nl
0000720   n   c  sp   -   l  sp   -   v  sp   2   2   2   2  sp   |  sp
0000740   n   c  sp   -   u  sp   $   e   t   h   e   d   i   t   i   p
0000760  sp   2   2   2   3  nl   f   i  nl   d   o   n   e  nl   e   c
0001000   h   o  sp   d   o   n   e  nl
0001010

all I can find next the the done is a nil character so I don't know how to fix it, please help

edit: heres the raw code

#!/bin/bash
ethviewstatus=0
ethviewmode=0
ethviewprotocol=0
while [ $etheditstatus = 1 ]
do
  if [ $etheditmode = 0 ]
  then
    if [ $etheditprotocol = 0 ]
    then
      nc -l -v 2223 | nc localhost 2222
    fi
    if [ $etheditprotocol = 1 ]
    then
      nc -l -v -u 2223 | nc localhost 2222
    fi
  fi
  if [ $etheditmode = 1 ]
  then
    if [ $etheditprotocol = 0 ]
    then
      nc -l -v -w15 2221 | etheditip=
      nc -l -v 2222 | nc $etheditip 2223
    fi
    if [ $etheditprotocol = 1 ]
    then
      nc -l -v -w15 2221 | etheditip=
      nc -l -v 2222 | nc -u $etheditip 2223
    fi
done
echo done

closed as off-topic by αғsнιη, Stephen Rauch, xhienne, Rui F Ribeiro, GAD3R Aug 5 '17 at 15:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – αғsнιη, Stephen Rauch, xhienne, Rui F Ribeiro, GAD3R
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    programming tip - if you want your code to be more readable, indent each nested level of if (or while or for etc) statements by a 2 or 4 spaces (or a tab). That will make the structure and logical flow of the script to be clearly visible at a glance. I'll edit your code to show you what I mean. – cas Aug 5 '17 at 1:00
  • 2
    notice how the indentation makes it obvious that there's a missing fi. BTW, i'd also recommend putting ; then and ; do on the same lines as the if or while statements rather than on a separate line...but that's a matter of subjective preference. I think it makes the code much easier to read and the structure easier to see. some people don't. Finally, you really need to get into the habit of always double-quoting your variables. e.g. use "$etheditstatus" rather than just $etheditstatus – cas Aug 5 '17 at 1:07
5

You didn't "close" this if with a fi:

if [ $etheditmode = 1 ]

Try indenting your code to make it easier for yourself (and others) to read, and check out shellcheck.net.

Not the answer you're looking for? Browse other questions tagged or ask your own question.