ubuntu - Writing code in terminal mode? -


i have write shell code in terminal mode on ubuntu. have code , it's supposed to, don't know how write in terminal mode. not allowed use text editors. below code suppose do.

echo "part 2 of program"   while true read firstnumber read secondnumber if [ $firstnumber -eq 99 ] || [ $secondnumber -eq 99 ];      echo "you have exited part 2 of program" break; elif [ $secondnumber -eq 0 ];     echo "the number must not 0"  else      math=$((firstnumber / secondnumber))     echo "$firstnumber divided $secondnumber = $math"  fi  done 

now have create file , write code in terminal mode. again, cannot use text editor. know how create file in terminal mode. however, not know how supposed write code on terminal mode without using text editor. supposed append code onto file. help.

this seems artificial restriction, however, such tasks can use.

cat > filename.txt

type or paste (ctrl-shift-v) in, press ctrl-d when you're finished. can use sed -i correct typos (unless that's considered text editor).

alternatively, host text somewhere online , use wget or curl download it.

it's either coming keyboard or net, options.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -