Linux Scripting, can ya help me out?

Hitaru

pew pew
Adventurer
Joined
Jan 8, 2008
Messages
2,782
Age
39
Location
Toronto
Main Job
Puppetmaster-Male
FFXIV
Hitaru
Hey guys,

So as a core subject in my program i had to take Linux, and i have an assignment which has me completely baffled. the details of it are:

1. Create a script named ~/public/analyze which:
(a) Displays a message asking the user for the filename of an XHTML file.

(b) Accepts one line of input from the user (the filename).

(c) Displays a count of the number of tables rows in the file.
You may assume that each XHTML block-level element is on a separate line.

2. Test the script thoroughly (create some XHTML files if necessary).

3. Include the student assignment submission form as a comment in the script.

4. Set the permission on the script so that your professor can execute it.

BONUS: (+10% of assignment mark): display an error message if the user
enters a filename that does not exist or is not readable.

I was wondering, if anyone here is proficient enough in Lunix scripting to help me out with this as i am completely lost.

Thanks
 
Hey guys,

So as a core subject in my program i had to take Linux, and i have an assignment which has me completely baffled. the details of it are:

1. Create a script named ~/public/analyze which:
(a) Displays a message asking the user for the filename of an XHTML file.

(b) Accepts one line of input from the user (the filename).

(c) Displays a count of the number of tables rows in the file.
You may assume that each XHTML block-level element is on a separate line.

2. Test the script thoroughly (create some XHTML files if necessary).

3. Include the student assignment submission form as a comment in the script.

4. Set the permission on the script so that your professor can execute it.

BONUS: (+10% of assignment mark): display an error message if the user
enters a filename that does not exist or is not readable.

I was wondering, if anyone here is proficient enough in Lunix scripting to help me out with this as i am completely lost.

Thanks

I fail to see if you're asking for help, or more for someone to do it *for* you, which I really hope is not the case.

Bash scripting is fairly simple, and http://www.linuxcommand.org/ has a good and simple tutorial to get you started with command-line scripting.

The only thing I'll give you freely:

chmod +x filename

That's all you get from me :)
 
yeah, i know that much lol

the trouble i am currently having is reading the file to see if there are tables in it... ; ;
 
hey guys, i got it done! it was a total of 8 LINES how much of a piss take is that XD....thanks trist and arc for helping me...


GREP is a wonderful thing
 
I'd grab the input and put it into an environmental variable ($filename, for example)
then running a command like more $filename |wc -l

That will give you the total lines in the file. I am assuming that the XHTML files are text files. You may have to subtract a specified number of lines to get the total number of rows in the table. I'm not sure, my knowledge of xhtml is sketchy at best.
 
Back
Top