LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-03-2009, 02:41 PM   #1
unim21
LQ Newbie
 
Registered: Apr 2009
Posts: 11

Rep: Reputation: 0
Practical challenges in scripting


I'm trying to think of various scenarios to further my knowledge of scripting (which is scarce). I've found some online but they are literally a little bit *too* beginner to keep my interest.

Does anyone have any interesting ideas?
 
Old 06-03-2009, 02:57 PM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 70
Here is one for you, give it a shot; write random figures to a file, the file name must be specified in args, you should test that a file name is specified, you should also test that the file doesn't already exist. The file size will be a random length, between 0 and 94 blocks.

You should expand it further by allowing the user to specify in args what they want the file to be filled with, including nul characters and specifically specified characters.

Further expansion; make the script fail if not run as root.

- Thats a script I give as a suggestion for students
 
Old 06-03-2009, 07:53 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Well, firstly I'd bookmark and flick through
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

that should pique your curiosity and you'd want to make sure you understand it all. (No need to memorize it all of course).
Secondly, start reading through the Programming Forum and try to solve as many qns as possible.
For research/study purposes, it doesn't matter if you go back through old qns, you'll still learn a lot by looking at other peoples answers.
 
Old 06-05-2009, 03:39 PM   #4
unim21
LQ Newbie
 
Registered: Apr 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks guys.

I'm stumped on this little thing here

[ != 0 ]

What is that telling me? I know [ -ne 0 ] and [ -eq 0 ], can't find any documentation on the exclamation though
 
Old 06-05-2009, 03:58 PM   #5
noctilucent
Member
 
Registered: Jun 2009
Distribution: slackware
Posts: 123

Rep: Reputation: 34
man test
 
Old 06-05-2009, 04:19 PM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
[ ! "$i" -eq "0" ] is the same than [ "$i" -ne "0" ]

! negates any predicate.
 
Old 06-05-2009, 10:20 PM   #7
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 70
Do you have any programming experience? Even asking my wife, we struggled to find too many examples where ! didn't mean 'not'. If you don't have any experience, you ought to go back to those *too* beginner exercises you seemed to oppose
 
Old 06-06-2009, 11:03 AM   #8
unim21
LQ Newbie
 
Registered: Apr 2009
Posts: 11

Original Poster
Rep: Reputation: 0
James,

I already figured that out - I'm back to the beer bottle program :-D

I have no experience, I'm teaching myself and for some reason I have this addiction to doing it in bash that I can't curb.

Thanks everyone for your help
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A query on Challenges in using C# within Mooshak. tpp Linux - Newbie 0 07-24-2008 06:04 AM
My Experience/Challenges with LFS. rvijay Linux From Scratch 15 03-01-2005 12:42 PM
Download Accelerator Challenges. rvijay Linux - Software 2 02-28-2005 02:23 PM
Linux challenges with laptops ernesto_cgf Linux - News 1 10-19-2004 10:04 PM
Linux Challenges. rvijay Linux - Newbie 26 11-07-2003 08:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration