Table Scripting

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Table Scripting
# 1  
Old 04-10-2013
Table Scripting

1. The problem statement, all variables and given/known data:

I have to make a manufacturing company. I need subdirectories for the company using three departments: Human Resources, Manufacturing, and Sales. I also need three scripts in order to create tables for each sub directory. Each script should ask for the department name, and for that department, create 5 sales persons with ID number and Name.
Stopping there (as there's more to ask, but i'm pretty sure i can finish the rest...)

2. Relevant commands, code, scripts, algorithms:

Vi Script[1-3] ? ? ?
mkdir
cd


3. The attempts at a solution (include all code and scripts):

1) mkdir Suit_and_Tie
2) cd Suit_and_Tie
3) mkdir Human Resources
4) mkdir Manufacturing
5) mkdir Sales
6) ???? I know i need a script, so using Vi Editor to start with will help. I am not familiar with the commands within it, especially in order to create tables that ask for each department name, so any help would be appreciated.

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Columbia Junior College - Sonora, California, USA, Ida Ponder, CMPSC9
# 2  
Old 04-11-2013
What OS are you on?
Did you look at what you created with mkdir? (use ls -l ...)
Isnt there something wrong?...
Since a script is a text file, yes you will have to use vi... but I am not sure about tables for you seem only to begin so what you call tables I understand as "files" now its up to you to say how the the fields are separated...
A script will not be executable just like that so look at chmod command, and the commands you put in a shell script are not vi internals but true unix commands so read again your notes so far on the commands you already know and submit to us a beginning of script so we can do our comments if you wish...

You will need variables to store what people have typed
(hint: you will need read command, so look what it does in a shellscript...)
You will have to display your screen, what command do you use for that?

Once someone entered values in your variables, you will want to write their content in a file...
# 3  
Old 04-11-2013
Ubuntu.
I'm not sure if anything is wrong, because all i needed was subdirectories within the "suit_and_tie" directory. I did look, and it's right where i needed it, at least i think so.. (you have me really thinking if i did something wrong now XD)
Yes, chmod 755 would work perfectly to make the script file executable, i believe.

By variables, do you mean system variables, like columns? Or how A = 1 and etc? I'm very slow when it comes to programming variables ....
# 4  
Old 04-12-2013
Well What do you expect from your command:
Code:
3) mkdir Human Resources

?

P.S.
shell script-ing IS programming...

Where is this script then?
# 5  
Old 04-12-2013
Oh~ I did it the right way, i just typed it here, wrongly...
mkdir "Human Resources" is what i meant to put.
The script isn't made because i don't even know how to start it... I am not familiar with scripting too well, however, I have been researching since i've posted this, but still nothing... Guess i'm just really slow when it comes to scripting.
# 6  
Old 04-15-2013
To start would be to write down the algorithm / pseudocode of what is being asked, once validated, transcript into shell code (commands).
Why 3 scripts?
Since you are asking for which dept.... One can do the job...
# 7  
Old 04-15-2013
Because each script is going to be doing three different things.
Human Resources script will have the sales persons(five of more) with ID numbers and names within it.
Manufacturing script will have all the products manufactured with part numbers, product names, Cost of Manufacturing, and sell price with 40% markup or more.
and the Sales script will have all the products sold: Salesperson ID, part numbers, costs of goods sold, and gross profit.

After that, i need to generate a report, gathering data from each department's data files created by the scripts.
I simply do not know what my teacher means when she writes "Write three scripts to create tables, "flat database files, using colon delimiters. Each script should ask for the department name."
I cannot write pseudocode or an algorithm to something I don't even understand. So when I figure out the algorithm, i'll try starting the script...

i'll read some more on unix/linux shell scripts and programming shells, as well as variables, environment and configuration variables, shell variables, and operators.

---------- Post updated at 07:20 PM ---------- Previous update was at 10:21 AM ----------

Ahh! Here we go!!
How does this script sound?
Code:
#=============================================
#Script Name: Add Employee
#By: Catori
#
#=============================================
trap "rm~/tmp/* 2> /dev/null; exit" 0 1 2 3
employeefile=./humanresources/employees
looptest=y
while [ $looptest = y ]
do
   clear
   tput cup 1 4; echo "Corporate Employee Addition"
   tput cup 2 4; echo "====================="
   tput cup 3 4; echo "Id Number:"
   tput cup 4 4; echo "Last Name:"
   tput cup 5 4; echo "First Name:"
   tput cup 6 4; echo "====================="
   tput cup 7 4; echo "Add another? (Y)es or (Q)uit:"
   tput cup 3 15; read idnum
   if [ "$idnum" = "Q" ]
   then 
      clear; exit
   fi
   tput cup 4 15; read lname
   tput cup 5 15; read fname
   #check blank
   if [ "$lname" > "       " ]
   then
      echo "$idnum:$lname:$fname" >> $employeefile
   fi
   tput cup 7 34; read looptest
   if [ "$looptest" = "Q" ]
   then
      clear; exit
   fi
done


Last edited by vbe; 04-16-2013 at 10:28 AM.. Reason: code tags, typos (missing $, t...) & indent...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

Getting Rid of Annoying Bootstrap Table Borders and Wayward Table Lines

Bootstrap is great; but we have had some issues with Bootstrapped <tables> (and legacy <fieldset> elements) showing annoying, wayward lines. I solved that problem today with this simple jQuery in the footer: <script> $(function(){ $('tr, td, fieldset,... (0 Replies)
Discussion started by: Neo
0 Replies

2. Forum Support Area for Unregistered Users & Account Problems

Creation of Oracle table through shell scripting

Hi, I am trying to create a table through shell scripting . I used a command sqlplus -s to connect to sqlplus and user as sysdba. but there is a problem in it. can anyone please solve this . #!/bin/bash $(`sqlplus -s / as sysdba <<eof create table sample (id,int); insert into sample... (1 Reply)
Discussion started by: Unregistered
1 Replies

3. UNIX for Advanced & Expert Users

How can i populate the record in to table using shell scripting?

LOG_DIR=/app/rpx/jobs/scripts/just/logs sendEmail() { pzCType="$1"; pzTitle="$2"; pzMsg="$3"; pzFrom="$4"; pzTo="$5"; pzFiles="$6"; pzReplyTo="$7" ( echo "From: $pzFrom\nTo: $pzTo\nSubject: $pzTitle${pzReplyTo:+\nReply-To: $pzReplyTo}" ] && echo... (1 Reply)
Discussion started by: ankit.mca.aaidu
1 Replies

4. Shell Programming and Scripting

Please help in populating output in table using shell scripting

Below is my code where i tried using table tag to print out put in table but its not working #!/bin/ksh #] && . ./.profile 2>/dev/null if test -f '.profile'; then . ./.profile; fi; #. .profile LOG_DIR=/app/rpx/jobs/scripts/just/logs sendEmail() { pzCType="$1";... (5 Replies)
Discussion started by: ankit.mca.aaidu
5 Replies

5. Shell Programming and Scripting

Shell scripting unable to send the sql query data in table in body of email

I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email. spool table_update.html; SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription'; spool off; exit; Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies

6. Shell Programming and Scripting

How to update a Oracle table through shell scripting?

My Code is get_week_date() { `sqlplus -s ${DQM_SQL_LOGON}@${DQM_SID} << EOF SET ECHO OFF SET FEEDBACK OFF SET PAGES 0 SET SERVEROUTPUT ON SET VERIFY OFF SET TRIMSPOOL ON (update file_level_qc fq set FQ.DATA_FILE_NAME='Hyvee_Pharmacy_Solutions_201304_v1.txt'... (2 Replies)
Discussion started by: karthick.cho
2 Replies

7. Shell Programming and Scripting

Table Scripting

Okay. I've been charged with an assignment to create tables. I "Made" a manufacturing company called "Suit and Tie". I need subdirectories for the company, using three departments: Human resources, Manufacturing, and Sales. 1) mkdir Suit_and_Tie 2) cd Suit_and_Tie 3) mkdir Human... (3 Replies)
Discussion started by: Catori
3 Replies

8. Shell Programming and Scripting

How to get the file size and count of a table using shell scripting?

Hi there, im a beginner to the shell scripting.i trying to extract a table from a db(IMD) and i have to get the count of that table and size of the file. can you help me out how to write the shall scriping for the above query. (2 Replies)
Discussion started by: pawanmamidi
2 Replies

9. Shell Programming and Scripting

Create a table using shell scripting

Hi Can we create a rectangular table as i have attached in the query . This is primarily for populating the created table with data gathered . Hope I made myself clear ... Pls suggest Thanks (1 Reply)
Discussion started by: ultimatix
1 Replies

10. Shell Programming and Scripting

[bash scripting] Generating a table with aligned fields

Hi everyone, I want to write a function which calculates the space needed between fields, to generate a table with aligned fields, like when you type "ls -l", the operating system generates a table with beautifully aligned fields. I've got this code so far: for line in $(cat tmpSearch)... (2 Replies)
Discussion started by: Aveltium
2 Replies
Login or Register to Ask a Question