LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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, 03: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, 03:57 PM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
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, 08:53 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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, 04: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, 04:58 PM   #5
noctilucent
Member
 
Registered: Jun 2009
Distribution: slackware
Posts: 123

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

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

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

Rep: Reputation: 69
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, 12:03 PM   #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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:04 AM
My Experience/Challenges with LFS. rvijay Linux From Scratch 15 03-01-2005 01:42 PM
Download Accelerator Challenges. rvijay Linux - Software 2 02-28-2005 03:23 PM
Linux challenges with laptops ernesto_cgf Linux - News 1 10-19-2004 11:04 PM
Linux Challenges. rvijay Linux - Newbie 26 11-07-2003 09:01 PM

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

All times are GMT -5. The time now is 08:40 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration