Simple if statement in bash doesn't work -


i learning little bit of bash in linux , can't understand why doesn't work. simple if statement , read command keep window opened. happens when execute .sh file terminal's window opens second , closes back. can't see message or check whether there's error or why doesn't work. if remove if block can see message , window remains opened. code inside file

count=99 if [ $count -eq 100 ];     echo "count 100" else     echo "count not 100" fi read -p "press enter continue" nothing 

i tried many other ways of using if structure seems none works

use dos2unix utility convert text file created on windows correct format linux. see this wikipedia page more details.

install if necessary:

$ sudo apt-get install dos2unix <snip> setting dos2unix (5.3.1-1) ... $ 

run on script:

$ dos2unix if.sh dos2unix: converting file if.sh unix format ... $  

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -