Sponsored Content
Homework and Emergencies Homework & Coursework Questions When I run the script, the cursor starts on the wrong line? Post 302920782 by ckleinholz on Sunday 12th of October 2014 09:50:39 PM
Old 10-12-2014
When I run the script, the cursor starts on the wrong line?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data: It's a shell script using a looping logic, trap, tput, if, while. Most of the scripts in this book aren't written for Ubuntu (which is what I'm running) but are supposed to be run on Knoppix or UNIX, so I've found quirks and I'm curious if this is one of them.
Everything seems to be working fine except where the cursor starts for the end user. Instead of starting where the Phone Number line is, it starts at Last Name. I cannot for the life of me figure out why. Everything else executes fine.

Code:
while [ $looptest = y ]
do
  clear
  tput cup 1 4; echo "Corporate Phone List Additions"
  tput cup 2 4; echo "=============================="
  tput cup 4 4; echo "Phone Number:  "
  tput cup 5 4; echo "Last Name   : "
  tput cup 6 4; echo "First Name  : "
  tput cup 7 4; echo "Middle Init : "
  tput cup 8 4; echo "Dept #      : "
  tput cup 9 4; echo "Job Title   : "
  tput cup 10 4; echo "Date Hired  : "
  tput cup 12 4; echo "Add Another? (y)es or (q)uit: "
  if [ "$phonenum" = "q" ]
         then
           clear; exit
  fi

2. Relevant commands, code, scripts, algorithms:
tput, if there's really not much to this...


3. The attempts at a solution (include all code and scripts): I thought this might be a quirk because the book isn't written for Ubuntu, but rather for Knoppix, UNIX or Fedora. I've found several instances where I've had to change a few syntaxes to get things to work right.
I've changed from dash to bash (thank you Google) and that did get one of my other scripts working correctly.



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course): Northern Virginia Community College, (I'm taking the class online so I've never actually been to the campus, but I think it's in Alexandria, VA), Leon Nicely, ITN-171
(This doesn't actually have to be turned in and isn't required, but I'm doing it to understand my actual homework...which is a bit sad)


Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Whats wrong with this 5 line script!

Hi #!/bin/sh user=$1 if " -eq 0 ] echo "No" else echo "Yes" fi I'm not quite sure whats wrong with this but I know its something silly. Any ideas? Thanks (9 Replies)
Discussion started by: c19h28O2
9 Replies

2. Shell Programming and Scripting

How to read a line when it starts with spaces

Hi , I use read command to get the input text, When i try to get the line starting with spaces or ending with spaces it automatically truncates the spaces and displays the remaining content. Code i tried (UserInput.sh): #!/bin/bash echo -n "Enter some text > " read text echo "You... (3 Replies)
Discussion started by: PrakashChinna
3 Replies

3. UNIX for Dummies Questions & Answers

how can I run something as root (modprobe, to be exact) every time computer starts.

I have the root password for my box, but I'm ignorant. So, every time I start my computer, I have to run this command /sbin/modprobe fuse as su, so that I can do other stuff (like mount remote directories locally using sshfs) I guess there's some file, like .bashrc, only it's applicable... (4 Replies)
Discussion started by: tphyahoo
4 Replies

4. UNIX for Dummies Questions & Answers

Two questions. First one; What are the ways in which a program starts to run.

This is my first post here so hello everyone! I know that a command of the programs name can start a program and clicking on a icon in GUI can as well as a startup shell script but how do I educate myself of the method that starts an application? Does the GUI run a script? What are the ways/ way... (2 Replies)
Discussion started by: theKbStockpiler
2 Replies

5. Solaris

run a service via startup script (correct me if I am wrong)

Environment Solaris 9 I have configured the Solaris9 as NTP client in which Solaris9 is syncing the time with a windows2008 R2 Server which is runing fine. Now I want that the xntpd service should start at startup. I did this via a script. Kindly correct if I did any thing wrong: 1.)Made... (9 Replies)
Discussion started by: z_haseeb
9 Replies

6. Shell Programming and Scripting

Merge multiple lines to one line when line starts with and ends with

example: comment Now_TB.table column errac is for error messages 1 - first 2 - second 3 -third ; in this example I need to be able to grab the comment as first word and ; as the last word and it might span a few lines. I need it to be put all in one line without line breaks so I can... (4 Replies)
Discussion started by: wambli
4 Replies

7. Shell Programming and Scripting

While loop - how to run processes one after another (2nd starts after first completes, and so on)

I'm a programming noob. I'm trying to run a memory intensive process for many files. But when I use the following script, it runs fine for the first 5-7 files, then runs out of memory. Monitoring the output files, it's clear the processes are going on in parallel. Once 5-7 of the files are being... (18 Replies)
Discussion started by: pathunkathunk
18 Replies

8. Shell Programming and Scripting

Moving line up if line starts with + sign.

Hello everyone, I'm struggling with this command: awk '!/^\+/{ORS=FS}/^\+/{ORS=RS}1' file1 > file2 What I want to do is to move any line that starts with the + sign 1 up, so its the continuation of the previous. The above command is messing the whole output, can you please let me know... (8 Replies)
Discussion started by: demmel
8 Replies

9. Shell Programming and Scripting

Need to write a shell script that starts one, then kills it, then starts another?

This is on a CentOS box, I have two scripts that need to run in order. I want to write a shell script that calls the first script, lets it run and then terminates it after a certain number of hours (that I specify of course), and then calls the second script (they can't run simultaneously) which... (3 Replies)
Discussion started by: btramer
3 Replies

10. Shell Programming and Scripting

Holding cursor position on one line

Hi there. It's easier to explain this with a pseudo code, I hope this makes sense: var1=hello echo $var1 some kind of loop echo loop counter done How do I hold the cursor position immediately behind the last output so I'd get something like: hello123456789 DOS used to use ","... (5 Replies)
Discussion started by: MuntyScrunt
5 Replies
MKCOVER(8)						      System Manager's Manual							MKCOVER(8)

NAME
mkcover - HylaFAX continuation cover page generation command SYNOPSIS
/var/spool/hylafax/bin/mkcover qfile template result DESCRIPTION
bin/mkcover is the command invoked by the facsimile server when a continuation cover page is required for an outbound job that is about to be retried. It generates a single POSTSCRIPT(R) page that is imaged according to the remote capabilities and transmitted as the cover page. The arguments are: qfile the job description file for the outbound job. template the cover page template file, as used by the faxcover(1) program. result the filename where the resultant POSTSCRIPT document should be written. The default mkcover command is a shell script that uses awk(1) to parse the job description file and generate the cover page document. The template file may be optionally compressed with compress(1), pack(1), or gzip(1); the filename suffix is used to decide whether or not the template file contains compressed data. SEE ALSO
faxq(8), hylafax-config(5), sendq(5) June 20, 1994 MKCOVER(8)
All times are GMT -4. The time now is 11:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy