text files to practice with?

text files to practice with?

am 16.10.2007 23:52:20 von chussung

I am learning shell scripting from an O'Reilly book. I don't have any
files that I know of that are interesting enough or safe to practice
with on my system (that I know of).

I am looking to find or generate text files to practice with. Last
resort I guess would be to hand code a list. However, I am trying to
learn how to avoid the manual steps by script.

Thanks,

Chad

Re: text files to practice with?

am 17.10.2007 00:26:56 von cfajohnson

On 2007-10-16, chussung wrote:
>
> I am learning shell scripting from an O'Reilly book. I don't have any
> files that I know of that are interesting enough or safe to practice
> with on my system (that I know of).
>
> I am looking to find or generate text files to practice with. Last
> resort I guess would be to hand code a list. However, I am trying to
> learn how to avoid the manual steps by script.

First scripting exercise: write a script to generate a number of
text files.

Or you could copy some of the configuration files from /etc to a
test directory.

--
Chris F.A. Johnson, author
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence

Re: text files to practice with?

am 17.10.2007 05:39:14 von Cyrus Kriticos

chussung wrote:
> I am learning shell scripting from an O'Reilly book. I don't have any
> files that I know of that are interesting enough or safe to practice
> with on my system (that I know of).

cp /etc/passwd /tmp

> I am looking to find or generate text files to practice with. Last
> resort I guess would be to hand code a list. However, I am trying to
> learn how to avoid the manual steps by script.

What is the sum of all UIDs and GIDs in /tmp/passwd?

:)

--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.

Re: text files to practice with?

am 17.10.2007 07:07:14 von Jan Schampera

Cyrus Kriticos wrote:

> What is the sum of all UIDs and GIDs in /tmp/passwd?


42!


SCNR,
J.

Re: text files to practice with?

am 17.10.2007 08:06:45 von wayne

chussung wrote:
> I am learning shell scripting from an O'Reilly book. I don't have any
> files that I know of that are interesting enough or safe to practice
> with on my system (that I know of).
>
> I am looking to find or generate text files to practice with. Last
> resort I guess would be to hand code a list. However, I am trying to
> learn how to avoid the manual steps by script.
>
> Thanks,
>
> Chad
>
I generate these from a variety of sources:

man something | col -bx >file.txt.

(Some of the larger man pages I've found include
gm, bash, ethereal, less, gcc, perltoc, and ethereal-filter.

Or copying log files, or saving netnews posts in files, works too.
But the nice thing about using man pages is that if you destroy
the file it is easy to recreate it.

-Wayne

Re: text files to practice with?

am 17.10.2007 13:50:49 von Maxwell Lol

Cyrus Kriticos writes:

> What is the sum of all UIDs and GIDs in /tmp/passwd?

Here's some more exercises:

What is the most common shell?
What is the most common GID?
Convert a UID to a username. Handle the case of two accounts with the same UID
Find the first unused UID above 100
How many applications use the same UID
Are there any missing passwords? (well, if there is't a /etc/shadow)
Find the sizes of each of the home directories