LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bash Shell vs Bourne (https://www.linuxquestions.org/questions/linux-newbie-8/bash-shell-vs-bourne-54060/)

infamous41md 04-08-2003 03:04 PM

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.

neo77777 04-08-2003 03:25 PM

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.

david_ross 04-08-2003 03:28 PM

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.

unSpawn 04-08-2003 03:37 PM

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

infamous41md 04-08-2003 08:59 PM

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 :cool: . 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:rolleyes:

Genesee 04-09-2003 10:18 AM

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

http://linuxcommand.org/writing_shell_scripts.html

:cool:

david_ross 04-09-2003 12:25 PM

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 :)

tcaptain 04-09-2003 12:48 PM

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.

whansard 04-09-2003 01:07 PM

there's a good bash howto on the web

infamous41md 04-10-2003 08:57 PM

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

whansard 04-10-2003 09:34 PM

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/

infamous41md 04-10-2003 09:40 PM

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"

david_ross 04-11-2003 03:18 PM

Try using "expect" rather than bash. "expect" is designed to act interactively with other programs.

david_ross 04-11-2003 03:19 PM

Having said that - you may be better with ssh depending on what you want to do.

infamous41md 04-11-2003 10:16 PM

yup i just d/l expect and tcl earlier today. still trying to figure it out, it seems cool tho.


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