Help running scripts in 1 file.

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Help running scripts in 1 file.
# 1  
Old 04-28-2010
Help running scripts in 1 file.

1. The problem statement, all variables and given/known data:
Running different parts of the assignment together in 1 script


2. Relevant commands, code, scripts, algorithms:
awk, nawk, bash, cp, cut, echo, expr, grep, join, mkdir, paste, rm, sort, sed, test, tr, true and false.


3. The attempts at a solution (include all code and scripts):
Code:
#!/bin/bash
join -a1 -1 1 -2 1  -e " " Prac1 Prac2 | sed '/^#/d' > temp
#use temp file.
#join -a1 -a2 -1 1 -2  -e " " temp Prac3 > Marks
#sort -n Marks > Marks

a=8
b=16
c=8
ans=0
ans1=0
ans2=0
ans3=0
while read -n 8 file
do
if [ $a = $c ]; then
	echo "$file":
	c=`expr $c + 16`
fi
if [ $a = $b ]; then
	#echo this is 16
	ans=`echo "$file"`
	#echo $ans
	ans1=${ans:0:1}
	ans2=${ans:2:1}
	ans3=${ans:4:1}
	expr $ans1 + $ans2 + $ans3
	b=`expr $b + 16`
fi
#echo $a
#echo $b
a=`expr $a + 8`

done < Marks > Marks2


4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Monash University, Melbourne, Australia, John Hurst, FIT3042.
http://infotech.monash.edu/units/fit3042/
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).

---------- Post updated 04-28-10 at 12:45 AM ---------- Previous update was 04-27-10 at 10:34 PM ----------

actually nvm I've got it working in file now. I've no idea why it gave me an error last night.

Last edited by bigubosu; 04-28-2010 at 01:15 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running scripts from a list

I am writing a bash script to run test some scripts. The names scripts of the scripts to tests are stored in an array. scptArr='chcksfrd.bash' scptArr='compute-misfit.bash' scptArr='compute-travel-times.bash' scptArr='create-data-tinv.bash' scptArr='create-docs.bash' ... (3 Replies)
Discussion started by: kristinu
3 Replies

2. Solaris

running scripts from cron

I need to run a script (from cron) that runs a second script. What worries me is that second script, when run from bash, upon finishing doesn't return to bash unless I press the 'Enter' key. I presume that's because last command in that script ends with & Could that be a problem for cron?... (2 Replies)
Discussion started by: orange47
2 Replies

3. Shell Programming and Scripting

Running Multiple scripts based on file size.

Hi, I have created 3 shell scripts which has to run one by one first two shell scripts will create a .txt files...which are used by the third shell script.Now I want to create a master script and run all these in a single script. Please give a pseudo code on how to so the same. ... (4 Replies)
Discussion started by: gaur.deepti
4 Replies

4. Shell Programming and Scripting

running scripts in minicom

Hi, I am new to use minicom. I want script to run on minicom with username and password as automated.(Expect). please could anyone suggest the sample code for it. Thanks in advance (2 Replies)
Discussion started by: vanid
2 Replies

5. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

6. Shell Programming and Scripting

Running many PERL scripts in one file

Hi, I have many PERL scripts in my system(Solaris 10 UNIX OS).I want to define all scripts in one file and run.Please suggest how to define. (3 Replies)
Discussion started by: sudhakaryadav
3 Replies

7. Shell Programming and Scripting

Running scripts via su

Hi All, Am using the below command to start my application using the root user su - bin -c "/home/bin/test/start.sh" but am getting the error becaue i have set some environment varibales in bin .profile when i execute the command start.sh by logging directly into bin account it's... (8 Replies)
Discussion started by: ravi.sri24
8 Replies

8. UNIX for Dummies Questions & Answers

Automatically Running Scripts

Can someone advise me how to get started automatically running scripts? I believe it has something to do with cron? (4 Replies)
Discussion started by: jeffreydavisjr
4 Replies

9. Shell Programming and Scripting

Running scripts unattended

Hi guys just wondering how i could make one of my scripts run unattended without the use of cron? (3 Replies)
Discussion started by: musicmancanora
3 Replies

10. Shell Programming and Scripting

Running scripts through cronjob.

Hello everybody, I'm trying to run a shell script in crontab file. But anyhow it's not getting executed. Following is the command that I've used in crontab. 30 07 * * * . ./.cronprofile;/om/reports/reportscripts/jitu/prod/prd_pre_to_post.sh 35 11 * * * .... (3 Replies)
Discussion started by: jitu.jk
3 Replies
Login or Register to Ask a Question