Skip to main content

Thread: if statment into a while read loop


how add if statement while read statement?

file contains

code:
1 2 3 4 5 6 7 8 9 10
code:
while read n; if [[ $n -le 5 ]]                   echo "$n"                   else echo "n greater 5"  fi  done < file
spiritech

where problem? code works fine.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk if statment into a while read loop


Ubuntu

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP