bash - How can I create a cover-page style text file via Linux script? -


i'd firstly point out i'm total noob when comes linux scripting, i'm trying create cover page via script , totally lost when comes formatting.

so far, have

#!/bin/bash  studentname = "jeremy"  studentnum = "0281190" coursesection = "702"  read -p "please enter course name: " coursename  read -p "please enter course number: " coursenum  read -p "please enter instructor name: " instrutornam  read -p "please enter submission date: " subdate  read -p "please enter submission title: " subname  read -p "submission subject: " subsubject  touch coverpage.txt  echo $subname $subdate   >> coverpage.txt  

what i'm trying have user enter main information contained in cover page, best output i've ended far cluttered top corner.

apologies in advance lack of clarity, not sure start.

this bash function center text on screen:

ctr() { s="$*"; width=$(( ($columns + ${#value})/2 )); printf "%${width}s\n" "$s"; } 

if don't want text centered on screen rather centered according specified width, replace $columns width.

example (which centered on terminal not browser):

$ ctr hello world                                        hello world 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -