How do I execute my file so it does one of 2 algorithms? such as ./file SPN??


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How do I execute my file so it does one of 2 algorithms? such as ./file SPN??
# 1  
Old 12-11-2011
How do I execute my file so it does one of 2 algorithms? such as ./file SPN??

Hi

I completed a project for school where we had to do cpu scheduling by reading in a file processes.txt and then doing 2 algorithms on it and printing out the order in which processes execute (current time to current process executing) and then doing some calculations (turn around time, etc.).

This is the part that confuses me:

your program should allow you to specify the abbreviation of the algorithm you wish to execute on the command line (see below for abbreviations).

I have one big file that does both of my algorithms at once and prints out their results one after the other. If I wanted to have it so my script executes one or the other, how do I go about this? for instance ./file SPN (to execute shortest process next algorithm) how would I do this? My entire code for both was written into the END{} portion in awk. Would I have to modify the entire thing?

pls keep in mind im still a newbie at this

Pls help!
# 2  
Old 12-11-2011
Search on the internet for positional parameters and learn how to use them in a shell script.
# 3  
Old 12-11-2011
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check file creation Time minutes and if file older then 5 minutes execute some stuff

Hello all, Info: System RedHat 7.5 I need to create a script that based on the creation time, if the file is older then 5 minutes then execute some stuff, if not exit. I thought to get the creation time and minutes like this. CreationTime=$(stat -c %y /tmp/test.log | awk -F" " '{ print... (3 Replies)
Discussion started by: charli1
3 Replies

2. Shell Programming and Scripting

Find a file and if exists , execute a different file

Good Morning All, I'm a novice and please excuse me if i did miss some of the forum rules. What my intention is, i have a file (services) residing @ /u01/Oracle/services. I know i can use the find command to find the "service" file. I get this file from a windows box and there is no certain... (8 Replies)
Discussion started by: thinkingeye
8 Replies

3. Fedora

Cannot execute binary file

Hi all, Probably somewhat of an obvous problem here but i'm no pro. I just bought a PengPod1000 at pengpod.com On it I have an image of Fedora 18. I am trying to run an application I wrote for Fedora 14 32 bit desktop on this tablet. With all permissions setup using chmod but I get... (7 Replies)
Discussion started by: fedora18
7 Replies

4. UNIX for Dummies Questions & Answers

File cannot execute

Hi everyone, I'm trying to run a plotting tool called gnuplot. So there is a /import/tools/exe directory which has a 'gnuplot' file and a '.gnu_tool_wrapper' file. When I type 'gnuplot' in this directory, it's supposed to go through the wrapper and run... (10 Replies)
Discussion started by: coldler
10 Replies

5. Web Development

Cannot execute sh file using button click in php file in apache

I the problem that i facing is cannot use button click to execute the sh file that store in the same location. the program file is a php file and running in apache2. the code that i run is show below <button onclick="sh()" name="sh">SH</button> <script type='text/javascript'> function sh()... (5 Replies)
Discussion started by: zhengkoon8
5 Replies

6. Shell Programming and Scripting

find specific file names and execute a command depending on file's name

Hi, As a newbie, I'm desperate ro make my shell script work. I'd like a script which checks all the files in a directory, check the file name, if the file name ends with "extracted", store it in a variable, if it has a suffix of ".roi" stores in another variable. I'm going to use these two... (3 Replies)
Discussion started by: armando110
3 Replies

7. Linux

cannot execute binary file

We are getting one error when we execute the binary file below mentioned, and ownership goes to root:nobody, how to resolve this problem. sh /home/pub/bin/awk: cannot execute binary file :confused: Pls help me out . (2 Replies)
Discussion started by: durgaprasadr13
2 Replies

8. Shell Programming and Scripting

Execute .sh file with sudo in it

Hi, I logged into a UNIX system as user ABC. I do not have root previleges and also do not have root password. I am executing few commands as: ABC****>sudo su - XYZ XYZ****>rm file1.txt XYZ****>exit ABC****> Now I want to execute all these commands from a .sh file ( or in any other... (2 Replies)
Discussion started by: _prasad
2 Replies

9. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies
Login or Register to Ask a Question