LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-04-2010, 10:31 AM   #1
sanket
LQ Newbie
 
Registered: Dec 2009
Posts: 1

Rep: Reputation: 0
Post Need help in Scripting


Hi,
I need to use scripting in linux...
Can anyone provide me guide for scripting??
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 08-04-2010, 10:41 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,253

Rep: Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559
You want the abs ( Advanced Bash Scripting guide ):
http://tldp.org/LDP/abs/html/
or it may be in your distros repo ( in debian for instance its called abs )
 
Old 08-04-2010, 12:12 PM   #3
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by Keith Hedger View Post
You want the abs ( Advanced Bash Scripting guide ):
http://tldp.org/LDP/abs/html/
or it may be in your distros repo ( in debian for instance its called abs )
that teaches bad programming. try this instead
 
0 members found this post helpful.
Old 08-04-2010, 12:45 PM   #4
rhklinux
Member
 
Registered: Jan 2010
Location: india/pune
Distribution: Arch Fedora20
Posts: 126

Rep: Reputation: 18
check mail i have sent to you !!
i am an indian
i will send you a nice book via email if you replied !!

Last edited by rhklinux; 08-04-2010 at 12:47 PM.
 
0 members found this post helpful.
Old 08-04-2010, 12:49 PM   #5
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by ghostdog74 View Post
that teaches bad programming.
I'd be interested to know which parts of the ABS guide you think are bad programming and why. Would you consider linking to a blog post or replying by PM?

@sanket,
http://tille.garrels.be/training/bash/
http://www.ibm.com/developerworks/library/l-bash.html
http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29
 
Old 08-04-2010, 04:16 PM   #6
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,253

Rep: Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559
Quote:
Originally Posted by ghostdog74 View Post
that teaches bad programming. try this instead
By all means tout your own web page but not at the expense of recognized guides, the abs guide is one of the best guides to bash scripting I have come across so you are talking out of your rear end, try citing a few examples if you are going to come out with such rubbish
 
Old 08-04-2010, 06:12 PM   #7
mcielen
LQ Newbie
 
Registered: Aug 2010
Posts: 3

Rep: Reputation: 1
Quote:
Originally Posted by Keith Hedger View Post
By all means tout your own web page but not at the expense of recognized guides, the abs guide is one of the best guides to bash scripting I have come across so you are talking out of your rear end, try citing a few examples if you are going to come out with such rubbish
+1

If you want to spend a few bucks, I can recommend http://www.amazon.com/exec/obidos/AS...uythisbooks-20 as well. It's well structured and easy to read.

disclaimer: I'm in no way related to amazon, apress or the author. I'm just a linux system engineer.
 
Old 08-04-2010, 09:10 PM   #8
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by Telengard View Post
I'd be interested to know which parts of the ABS guide you think are bad programming and why. Would you consider linking to a blog post or replying by PM?
Ok, to show you and Keith Hedger what i meant, see this, example 11-3. Everybody knows parsing file names with ls is bad
Code:
Example 11-3. Fileinfo: operating on a file list contained in a variable
...
ls -l $file | awk '{ print $8 "         file size: " $5 }'
...
because file names can contain spaces, and field $8 is not exactly correct. It can have $9, $10 etc
That's one for you.

And if you really read the whole document, you would come across others like

for file in (cat file) #useless use of cat
for file in (ls dir) # useless use of ls
using backticks instead of $()
cat file | while read ... #useless use of cat
and many others...

Of course i am not saying the whole thing is not worth reading, just don't pick up these bad habits.

Now, is that rubbish that i am spouting, Keith Hedger.?

Last edited by ghostdog74; 08-04-2010 at 09:19 PM.
 
2 members found this post helpful.
Old 08-05-2010, 12:04 AM   #9
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by ghostdog74 View Post
Everybody knows parsing file names with ls is bad
Quite right. "The UNIX Programming Environment" by Kernighan and Pike implies as much in the early chapters. It is better to iterate files from the output of find.

Quote:
And if you really read the whole document
Granted I have not read the entire document, and it has been a few months since my last session with it. The examples you have pointed out are atrocious enough to warrant some skepticism of its usefulness as a learning tool.

Thank you.
 
  


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
[SOLVED] scripting indur Linux - Newbie 3 04-25-2010 09:57 AM
Firefox Scripting Add-on (Scripting HTML / Javascript inside Firefox) linuxbeatswindows Programming 1 09-18-2009 11:09 PM
scripting kb100 Programming 16 08-17-2006 07:41 AM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 05:29 AM
Need Help on Scripting wongedan Linux - Newbie 2 08-23-2004 09:11 PM


All times are GMT -5. The time now is 09:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration