Absurd Minds
http://forums.absurdminds.net/

Bash script that mimics the functionality of 'wc -l'
http://forums.absurdminds.net/viewtopic.php?f=58&t=3744
Page 1 of 1

Author:  heemer [ 05 Nov 2016 17:34 ]
Post subject:  Bash script that mimics the functionality of 'wc -l'

I really need help with this programming assignment lol.
This is my first time ever scripting in BASH.

prompt: http://www.jeangourd.com/classes/csc222 ... pt-1/1.pdf

Author:  GoatMips [ 05 Nov 2016 21:48 ]
Post subject:  Re: Bash script that mimics the functionality of 'wc -l'

What exactly do you need help with? Understanding the concept or something like that?

First, you should familiarize yourself with what wc actually does: http://www.computerhope.com/unix/uwc.htm. It has quite a bit of functions for it. Also, "man" is your friend: http://pastebin.com/AfdZYZp8

I will try my best without giving you a direct answer, because school is school.
  • For the first function, you have to count how many lines something is. There is a special char that dictates the newline function.
  • As for the second, you have to read from a file and output how many lines is in there. Same principle as from above.
  • As for the third, you basically mimic the second except with a file name.
  • The fourth is also much like the second and third, however its an array of file names. So with that, just execute the third method for every file provided.
  • The fifth is a simple help line. This is a basic return statement that displays information on how to use the command. Also, "-h" is synonymous to "--help".
Hope this helps.

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/