The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
can someone help me with modifying this file eamani_sun Shell Programming and Scripting 2 05-22-2008 02:15 PM
Modifying simple commands to create a script rocinante Shell Programming and Scripting 8 06-03-2007 10:35 PM
Modifying a csv file from Shell Script not4google Shell Programming and Scripting 2 11-21-2006 06:47 AM
modifying my shell nico-hellas Shell Programming and Scripting 1 08-05-2005 10:43 AM
modifying the writing of a log... Nicol Shell Programming and Scripting 2 04-13-2005 11:05 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-18-2008
dakkorn dakkorn is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 2
need help with understanding and modifying script

hi all,

i am new to UNIX. this is my first time using Ubuntu. i need to do this for my fyp.

i am using an artificial neural network model to predict the yield strength of steel. the shell script used to execute this model is as shown here:

#Thomas Sourmail, Cambridge University / Neuromat Ltd

echo "*******************************************************"
echo "* Model to estimate the elongation (%) of a steel *"
echo "* as a function of elemental composition, heat and *"
echo "* mechanical treatments and grain size. *"
echo "* *"
echo "* More information: Materials Algorithms Project *"
echo "* *"
echo "* Model prepared with the Model Manager, Neuromat Ltd *"
echo "* More information: Neuromat Ltd::Modelling Solutions for Materials Science *"
echo "* *"
echo "* Authors: T.C.Illingworth, T.Sourmail, H. Bhadeshia *"
echo "* and D.J.C. MacKay *"
echo "*******************************************************"
echo "Press Return to continue"
read dummy

echo "*******************************************************"
echo "* *"
echo "* DISCLAIMER: This program, is provided AS IS without *"
echo "* warranty of any kind. We make no warranties, express*"
echo "* or implied, that this program, procedures and data *"
echo "* are free of error, or are consistent with any parti-*"
echo "* cular standard of merchantability, or that they *"
echo "* will meet your requirements for any particular *"
echo "* application. *"
echo "* IT SHOULD NOT BE RELIED ON FOR SOLVING A PROBLEM *"
echo "* WHOSE INCORRECT SOLUTION COULD RESULT IN INJURY TO *"
echo "* A PERSON OR LOSS OF PROPERTY. *"
echo "* *"
echo "* If you do use this program, it is at your own risk. *"
echo "* The Department of Materials Science and Metallurgy, *"
echo "* University of Cambridge, and the National Physical *"
echo "* Laboratory disclaim all liability for direct, inci- *"
echo "* dental or consequential damages resulting from your *"
echo "* use of this program. *"
echo "* *"
echo "*******************************************************"
echo ""
echo "Agree ? (y/*)"
read answer

correct='y'

if test $answer != $correct
then
exit
fi
#To normalise the data
wc test.dat > wc.out
read line total dummy < wc.out
rm wc.out

no_of_lines=$line
let no_of_columns=$total/$line

cmd='echo $line > no_of_rows.dat'
eval $cmd

echo ""
echo "I found $no_of_lines lines and $no_of_columns variables" > predict.log
echo ""

./.normalise $no_of_lines $no_of_columns >&-

# Count again in case the first line contained labels

wc norm_test.in > wc.out
read line total dummy < wc.out
rm wc.out
no_of_lines=$line
echo "Now $no_of_lines line in norm_test.in" >> predict.log

# This is to produce the required instruction file for generate44

./.generate_spec $no_of_columns $no_of_lines $no_of_lines 1 $no_of_lines spec.t1 norm_test.in d/outran.x >&-

# The list of models making up the committee, you can edit that if you wish
# to remove the contribution of some models (just place a # in front of the two
# corresponding lines)

./.generate44 spec.t1 13 ./c/_wm6f ./c/_wm6f.lu >&-
mv _out outprdt/out1
./.generate44 spec.t1 17 ./c/_wq6f ./c/_wq6f.lu >&-
mv _out outprdt/out2
./.generate44 spec.t1 14 ./c/_wn6f ./c/_wn6f.lu >&-
mv _out outprdt/out3
./.generate44 spec.t1 14 ./c/_wn3f ./c/_wn3f.lu >&-
mv _out outprdt/out4

# Combining the individual models into committee result

./.gencom 4 $no_of_lines ./outprdt >&-

#To un-normalise the result

./.treatout $no_of_lines $no_of_columns

mv com.dat outprdt/com.dat
#mv test.dat outprdt/test.dat
#mv unnorm_com result

rm _* no_of_rows.dat norm_test.in spec.t1

echo "Display results ? (y/*)"
read answer
if test $answer = $correct
then
cat result
fi
echo "*******************************"
echo "* *"
echo "* Predictions done *"
echo "* results saved in 'result' *"
echo "* *"
echo "*******************************"



when i run the program this is what shows:

desktop:~/Desktop/YS$ ./model.gen
*******************************************************
* Model to estimate the elongation (%) of a steel *
* as a function of elemental composition, heat and *
* mechanical treatments and grain size. *
* *
* More information: Materials Algorithms Project *
* *
* Model prepared with the Model Manager, Neuromat Ltd *
* More information: Neuromat Ltd::Modelling Solutions for Materials Science *
* *
* Authors: T.C.Illingworth, T.Sourmail, H. Bhadeshia *
* and D.J.C. MacKay *
*******************************************************
Press Return to continue

*******************************************************
* *
* DISCLAIMER: This program, is provided AS IS without *
* warranty of any kind. We make no warranties, express*
* or implied, that this program, procedures and data *
* are free of error, or are consistent with any parti-*
* cular standard of merchantability, or that they *
* will meet your requirements for any particular *
* application. *
* IT SHOULD NOT BE RELIED ON FOR SOLVING A PROBLEM *
* WHOSE INCORRECT SOLUTION COULD RESULT IN INJURY TO *
* A PERSON OR LOSS OF PROPERTY. *
* *
* If you do use this program, it is at your own risk. *
* The Department of Materials Science and Metallurgy, *
* University of Cambridge, and the National Physical *
* Laboratory disclaim all liability for direct, inci- *
* dental or consequential damages resulting from your *
* use of this program. *
* *
*******************************************************

Agree ? (y/*)
y




CREATING 'spec.t1' ........
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------


You have not precised the name of the minmax and data files Using MINMAX and com.dat by default
4 39 MINMAX
160.6175991124.322998
Display results ? (y/*)
y
Prediction Error Pred-Err Pred+Err
372.627014 122.571762 250.055252 495.198761
387.139435 115.390228 271.749207 502.529663
399.405487 109.249504 290.155975 508.654999 409.364410 104.132217 305.232208 513.495667
*******************************
* *
* Predictions done *
* results saved in 'result' *
* *
*******************************
benedict@benedict-desktop:~/Desktop/YS$




i need to get rid of the disclaimer and i dont want the computer to ask to press return to continue or agree or ask display results. i just want it to run the program and give the results automatically. how shd i modify the attached file to achieve this? when i run the program it shd just show the following.


CREATING 'spec.t1' ........
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------
-----------------------------------------------
Generating outputs using network
-----------------------------------------------


You have not precised the name of the minmax and data files Using MINMAX and com.dat by default
4 39 MINMAX
160.6175991124.322998
Prediction Error Pred-Err Pred+Err
372.627014 122.571762 250.055252 495.198761
387.139435 115.390228 271.749207 502.529663
399.405487 109.249504 290.155975 508.654999 409.364410 104.132217 305.232208 513.495667
*******************************
* *
* Predictions done *
* results saved in 'result' *
* *
*******************************


Can anyone help me modify the program to do this?

Your help will be greatly appreciated.

Thank you.
  #2 (permalink)  
Old 01-18-2008
adderek adderek is offline
Registered User
  
 

Join Date: Sep 2007
Location: Poland
Posts: 111
Contact with author of this code and ask him for help. He must agree before you could use that code. It seems to be Thomas Sourmail.
  #3 (permalink)  
Old 01-18-2008
Neo's Avatar
Neo Neo is online now Forum Staff  
Administrator
  
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 6,797
Hi Adderek,

I think your post may be out-of-line.

First of all, there is no copyright notice in the code.

Second of all, it says "use at your own risk".

So, I don't see anything that is illegal, wrong or unethical, unless there is a copyright that was removed.

Also, you are not a moderator here, so please post your concerns privately. Thank you.

On the other hand, if this post is homework, it may be a rule violation anyway.
  #4 (permalink)  
Old 01-21-2008
dakkorn dakkorn is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 2
Help!

hi all,

this is not homework. I just need help understanding the script because I have no knowledge or experience with linux shell scripting. my work involves the design of steels. But for me to do that i need to understand the script and modify it so that it would work with another program that i am using.

maybe someone would be kind enough to explain what is going on in the program so i can make the necessary changes. i have limited time and I would really appreciate all the help i can get.

Thank you very much. It will save me a lot of stress, if someone could help me with this. I have gotten this program from this website MAP Program Steel_YS

I am not violating any laws using this.
  #5 (permalink)  
Old 01-24-2008
tsourmail tsourmail is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 1
mods

Just remove all the lines copied below

I'd be interested to know if the model works fine...


----

echo "*******************************************************"
echo "* Model to estimate the elongation (%) of a steel *"
echo "* as a function of elemental composition, heat and *"
echo "* mechanical treatments and grain size. *"
echo "* *"
echo "* More information: Materials Algorithms Project *"
echo "* *"
echo "* Model prepared with the Model Manager, Neuromat Ltd *"
echo "* More information: Neuromat Ltd::Modelling Solutions for Materials Science *"
echo "* *"
echo "* Authors: T.C.Illingworth, T.Sourmail, H. Bhadeshia *"
echo "* and D.J.C. MacKay *"
echo "*******************************************************"
echo "Press Return to continue"
read dummy

echo "*******************************************************"
echo "* *"
echo "* DISCLAIMER: This program, is provided AS IS without *"
echo "* warranty of any kind. We make no warranties, express*"
echo "* or implied, that this program, procedures and data *"
echo "* are free of error, or are consistent with any parti-*"
echo "* cular standard of merchantability, or that they *"
echo "* will meet your requirements for any particular *"
echo "* application. *"
echo "* IT SHOULD NOT BE RELIED ON FOR SOLVING A PROBLEM *"
echo "* WHOSE INCORRECT SOLUTION COULD RESULT IN INJURY TO *"
echo "* A PERSON OR LOSS OF PROPERTY. *"
echo "* *"
echo "* If you do use this program, it is at your own risk. *"
echo "* The Department of Materials Science and Metallurgy, *"
echo "* University of Cambridge, and the National Physical *"
echo "* Laboratory disclaim all liability for direct, inci- *"
echo "* dental or consequential damages resulting from your *"
echo "* use of this program. *"
echo "* *"
echo "*******************************************************"
echo ""
echo "Agree ? (y/*)"
read answer

correct='y'

if test $answer != $correct
then
exit
fi



echo "Display results ? (y/*)"
read answer
if test $answer = $correct
then
cat result
fi
echo "*******************************"
echo "* *"
echo "* Predictions done *"
echo "* results saved in 'result' *"
echo "* *"
echo "*******************************"
Closed Thread

Bookmarks

Tags
linux, ubuntu

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0