LinuxQuestions.org
Visit Jeremy's Blog.
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 04-08-2003, 03:04 PM   #1
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
Bash Shell vs Bourne


Hi, simple question for someone a little more knowledgable than me. I am very eager to learn some advanced shell scripting techniques. I have been scouring the web for a good book to teach me this, and i have come across one that is very highly praised: callled UNIX Shell Programming, written by Kochan and Wood. It is based on the Bourne shell. I am running Bash, and i am aware it is a descendant from Bourne. But my question is this, how different are the two? Do you think i should buy that book or look for one specifically on the Bash shell? Are there such dramatic differences between the 2 shells that i would find myself having to drastically reinterpret some of things in that book? I only ask b/c that book is so highly praised and many of the books that i find about simply Bash have some harsh criticism by readers.
 
Old 04-08-2003, 03:25 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 55
There are no dramatic differences, just that Bourne Again Shell (bash) had become more user friendly (autocomplete feature, etc), hence it is a default shell on most Linux installs. As for the book get it in any case.
 
Old 04-08-2003, 03:28 PM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Why do you want a book?

The fact that you are able to post here shows that you have access to the biggest library known to man.
 
Old 04-08-2003, 03:37 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,140
Blog Entries: 54

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
Bash is a "modernized" Sh and "echo" seems to be it's only real PITA mentioned AFAIK. Scripts running in Sh will run in Bash, but the other way around shouldn't be assumed automatically (as goes for any script compatibility I guess). If you've not read seen these sites, I'd say go there first, *then* buy the book:
Advanced Bash Scripting Guide (ABS): http://www.tldp.org/LDP/abs/html/
Heiner's SHELLdorado: http://www.shelldorado.com
Linuxguru's shell scrip resources: http://www.linuxguruz.org/z.php?id=911
 
Old 04-08-2003, 08:59 PM   #5
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by david_ross
Why do you want a book?
The fact that you are able to post here shows that you have access to the biggest library known to man.
-well i am very grateful for the help that i have gotten here. but u cant ask questions without knowing what to ask them about! i understand basic shell scripts and im learning perl as we speak, but im interested in making some complex scripts. and there are so many different commands/shortcuts for doing things that i need somewhere to start learning about them rather than just asking questions aimlessly on here. for example i wanted to write script that will login to my stock account for me and send me an email if certain things have changed. there's about a billion other projects in waiting in my head, and most of the resources i find on the net arent that thorough. But that 1st link that unSpawn has given me seems to be a book in itself! much thnx i will be using that one for now . is it just me or does anyone else like having a book around? i personaly have at least a dozen or more books from C++ to perl to MySql in addition to the countless printouts of webpages. which is always nice when u have a crappy internet connection like me that goes down at the most inopportune times
 
Old 04-09-2003, 10:18 AM   #6
Genesee
Member
 
Registered: Dec 2002
Distribution: Slackware
Posts: 927

Rep: Reputation: 30
here's a quick set of lessons to get started:

http://linuxcommand.org/writing_shell_scripts.html

 
Old 04-09-2003, 12:25 PM   #7
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Quote:
Originally posted by Genesee
here's a quick set of lessons to get started:

http://linuxcommand.org/writing_shell_scripts.html
That's what I was talking about! I didn't mean to ask every question on LQ but there are so many resources on the internet - especially on technology subjects - I don't usually use books.

1 book - 1 way to reach a solution.
3 book - 3 ways to reach a solution.
Internet - Every way to reach a solution.

But who am I to say use the net - Use whatever you feel comfortable with
 
Old 04-09-2003, 12:48 PM   #8
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
Quote:
Originally posted by david_ross
That's what I was talking about! I didn't mean to ask every question on LQ but there are so many resources on the internet - especially on technology subjects - I don't usually use books.
I agree with you mostly, but I find that some books really wrap up details in an organized way that will click better than reading a how-to on the net.

For example, I picked up a book on Samba Server Administration. It had nothing that you can't find online..but it put it together in such a way that I understood it faster...which then allowed me to go online and find any missing information.

Another good example is "Running Linux" from Oreilly. An awesome basic reference book for the beginner...because sometimes you need more than just being able to ask questions...you need to know what you need to ask.
 
Old 04-09-2003, 01:07 PM   #9
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
there's a good bash howto on the web
 
Old 04-10-2003, 08:57 PM   #10
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Original Poster
Rep: Reputation: 30
i've been whizzing thru all these guides....they are good at introducing the ideas but i've been progging C++ for almost 3 years now so its all easy stuff. what im interested in is this kind of stuff: when u execute a command, such as ping xxx.xxx.x.xxx, how can u grab that info that comes back in a script? or when i try to telnet to a port? -how can i get the value that it returns? such as was the session succesful? or if i telnet into the port, how do i then enter more commands and check their success? etc... the list goes on and on
 
Old 04-10-2003, 09:34 PM   #11
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
Learning the bash Shell, 2nd Edition
By Cameron Newham, Bill Rosenblatt
2nd Edition January 1998
1-56592-347-2, Order Number: 3472
334 pages, $29.95 US, $42.95 CA, 20.95 UK

http://ftp.nchu.edu.tw/ftp/Documenta...nutshell/bash/

Last edited by whansard; 04-10-2003 at 09:38 PM.
 
Old 04-10-2003, 09:40 PM   #12
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Original Poster
Rep: Reputation: 30
thnx whansard, i will be buying that. but for now, i have figured out how to extract the output using the `command` , but i cant figure out how to send another command once i've gotten into telnet. anyone know? so far i have this:

script_name=`telnet wcsu.edu 25`
#need something here to enter "quit" command ??
echo "Telnet output is";echo "$script_name"

script_name=`telnet wcsu.edu 25`
sleep 3
#echo "quit"; echo <-tried this to get it to quit, doesn't work
result=`quit` <-trying this...not working, just hangs
echo "Telnet output is"; echo "$script_name"

Last edited by infamous41md; 04-10-2003 at 10:00 PM.
 
Old 04-11-2003, 03:18 PM   #13
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Try using "expect" rather than bash. "expect" is designed to act interactively with other programs.
 
Old 04-11-2003, 03:19 PM   #14
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Having said that - you may be better with ssh depending on what you want to do.
 
Old 04-11-2003, 10:16 PM   #15
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Original Poster
Rep: Reputation: 30
yup i just d/l expect and tcl earlier today. still trying to figure it out, it seems cool tho.
 
  


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
'sh' shell - Actually calls legacy Bourne shell, or uses system default? Dtsazza Linux - Software 1 10-28-2005 09:20 AM
redirecting output in Bourne shell trutnev Linux - Software 2 04-22-2004 03:55 AM
bourne vs bash alaios Linux - Software 2 03-13-2004 12:16 AM
Bourne Again SHell help MagInnovision Linux - Newbie 2 02-04-2003 03:43 PM
Bourne shell programming noodle123 Programming 3 04-16-2002 03:46 AM


All times are GMT -5. The time now is 11:42 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration