Need Help writing Bulk-Compiling Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Help writing Bulk-Compiling Script
# 1  
Old 07-11-2012
Question Need Help writing Bulk-Compiling Script

I'm trying to write a script that can compile my students' homework submissions in bulk. My students' c code is buried in a file path that looks like this:
./Homework\ X/Doe, John/Submission\ Attachments

Where I'm struggling is determining how to navigate to each of the submission attachment directories so I can compile their code.

I'd like my script to be as simple as typing in the name of the Homework directory and the makefile path, and having the script take care of the rest.
# 2  
Old 07-11-2012
How to compile them really depends on what they are. Unless they use makefiles, I can't think of a good all-in-one solution. Even if they do use makefiles, they'd have to all write them the same way.
# 3  
Old 07-11-2012
Compiling isn't the issue. What I need is a way to navigate to each of the 'Submission Attachment' folders, without letting the computer know the names of all the students in advance. The directories with the students names are the only directories inside 'Homework X'.
# 4  
Old 07-11-2012
Oh, that's simple enough.

Code:
#!/bin/sh

for DIR in "/path/to/Homework X"/*
do
        [ -d "$DIR" ] || continue # Ignore non-folders

        echo "Do stuff with $DIR"
done

This User Gave Thanks to Corona688 For This Post:
# 5  
Old 07-11-2012
Thanks! I'll try that out.

---------- Post updated at 02:15 PM ---------- Previous update was at 02:07 PM ----------

I've run into an error message I do not understand:

./autograder2.sh: line 2: $'\r': command not found
./autograder2.sh: line 4: syntax error near unexpected token `$'do\r''
'/autograder2.sh: line 4: `do

What does this mean?
# 6  
Old 07-11-2012
It means, don't edit your scripts in Microsoft Notepad. Edit them in a UNIX text editor of some sort, to prevent Windows from filling them with useless carriage returns.
This User Gave Thanks to Corona688 For This Post:
# 7  
Old 07-11-2012
Ah, ok. Thank you. I was using notepad++. I'm using cygwin to emulate linux.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compiling and Executing a Java File With a Shell Script

I'm trying to use a shell script to compile and execute a java file. The java classes are using sockets, so there is a client.java file and a server.java file, each with their own shell script. I also want to handle the command line arguments within the shell script, not the java classes. The... (1 Reply)
Discussion started by: britty4
1 Replies

2. Shell Programming and Scripting

Need script for transferring bulk files from one format to text format

"Help Me" Need script for transferring bulk files from one format to text format in a unix server. Please suggest (2 Replies)
Discussion started by: Kranthi Kumar
2 Replies

3. Shell Programming and Scripting

Shell or perl script to replace XML text in bulk

Hi, I am looking for assistance over shell or perl (without XML twig module) which replace string in XML file under particular branch..example of code file sample.. Exact requirment : Replace "Su saldo es" in below file with "Your balance" but only in XML branch of Text id=98 and Text Id=12... (7 Replies)
Discussion started by: Ashu_099
7 Replies

4. Shell Programming and Scripting

bulk renaming of files in sftp using script

Hi, Am using sftp (dsa method) to transfer 20 files from one server(sftp) to another (local). After the transfer is complete the files in the sftp server has to be renamed from .txt extension to .done extension ( aa.txt to aa.done, bb.txt to bb.done and likewise...). I tried rename command... (4 Replies)
Discussion started by: Sindhuap
4 Replies

5. Solaris

Change passwd for bulk servers using SSH script

Hi, I need to Change passwd for bulk servers using SSH script. I have one server, from which i can reach all the servers without password via SSH. There is some expect script, from which i can achieve it. Can any one help me out here. Thanks in advance. Vicky (1 Reply)
Discussion started by: vickyingle5
1 Replies

6. Shell Programming and Scripting

Compiling to shell script

I have the following lines of script to run sequentially(i.e one after the other as arranged). how can I compile it to one shell script of the form DATABASE.sh awk '$2~/eaw/{BSC=$3}{print BSC,$0}' RXMOP.log | grep GSM | awk '{print $1,$2,$3,$5}'>TX.data sed 's/RXOTX/RXORX/g' TX.data>RX.data sed... (4 Replies)
Discussion started by: aydj
4 Replies

7. Shell Programming and Scripting

Compiling Shell script

I want to compile a shell script so that anyone can run it on any linux platform without being able to view its content. Is there any way to do this? Thanks in advance ---------- Post updated at 12:00 PM ---------- Previous update was at 11:35 AM ---------- shc creates a stripped binary ... (2 Replies)
Discussion started by: proactiveaditya
2 Replies

8. Shell Programming and Scripting

Help me in writing the script

Hi, I have written a script which converts a give hexdecimal value to binary value in perl. But now, the problem is I should read every bit of it ( if its 10101010, i should read the value in each position and if the value in that position is 1 i should print a string and should exit if its... (1 Reply)
Discussion started by: prakashreddy
1 Replies

9. UNIX for Dummies Questions & Answers

Need help writing this script

Here is the script I am trying to write along with my answer I wrote. Please help me understand why it doesn't work. Create an executable script file called "newname" that will perform the followings: 1. Rename a file upon the user's request. If the file exists, prompt the user for... (1 Reply)
Discussion started by: wiggles
1 Replies

10. Programming

Errors while Compiling a PC script.

Hi all, I have created a post-C (PC) script OrdItmpopulate.pc. When I am compiling this using the “Make” command I am getting the following error. My “make” command looks like this: make -f $ORACLE_HOME/precomp/demo/proc/demo_proc.mk build EXE=OrdItmpopulate8.exe OBJS="OrdItmpopulate8.o"... (1 Reply)
Discussion started by: musavir19
1 Replies
Login or Register to Ask a Question