|
Home > Archive > Unix Shell > October 2007 > text files to practice with?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
text files to practice with?
|
|
| chussung 2007-10-16, 7:22 pm |
| 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
| |
| Chris F.A. Johnson 2007-10-16, 7:22 pm |
| 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 <http://cfaj.freeshell.org/shell/>
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
| |
| Cyrus Kriticos 2007-10-17, 1:33 am |
| 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.
| |
| Jan Schampera 2007-10-17, 1:33 am |
| Cyrus Kriticos wrote:
> What is the sum of all UIDs and GIDs in /tmp/passwd?
42!
SCNR,
J.
| |
|
| 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
| |
| Maxwell Lol 2007-10-17, 7:31 am |
| Cyrus Kriticos <cyrus.kriticos@googlemail.com> 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
|
|
|
|
|