LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-16-2008, 12:29 PM   #1
envisage
LQ Newbie
 
Registered: Jun 2007
Posts: 9

Rep: Reputation: 0
Link to basic bash scripting e-guide


Hi,

Can any one guide me to download and learn basic bash scripting.. and e-tutorial or pdf or doc ..

Thanks
 
Old 01-16-2008, 12:59 PM   #2
al2
Member
 
Registered: Mar 2007
Location: Sweden
Distribution: Slackware
Posts: 40

Rep: Reputation: 18
Smile

There are several guides to bash. Try one of these:
http://www.physics.ohio-state.edu/~n...ompt-HOWTO.pdf
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
 
Old 01-16-2008, 05:11 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
And also
http://www.tldp.org/LDP/abs/html/
http://rute.2038bug.com/index.html.gz
 
Old 01-19-2008, 06:46 AM   #4
envisage
LQ Newbie
 
Registered: Jun 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks al2.. Its helps me a lot to server my job..
Moreover.. chrism01.. can you help me in the 2nd link.. its a zip file which when I saved.. then the path is not correctly mentioned or what.. no link is opening... can you guide me... how to work with
http://rute.2038bug.com/index.html.gz

Thanks anyway to both of you for you assistance
 
Old 01-19-2008, 07:23 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by envisage View Post
Thanks al2.. Its helps me a lot to server my job..
Moreover.. chrism01.. can you help me in the 2nd link.. its a zip file which when I saved.. then the path is not correctly mentioned or what.. no link is opening... can you guide me... how to work with
http://rute.2038bug.com/index.html.gz

Thanks anyway to both of you for you assistance
This opens on my system with no problems. (Firefox 2.0.0.11)
I've never seen the .gz extension on html pages....

This is weird: If I save the page to disk and then try to open it, it offers only to open with Ark. This fails, as does double-clicking. I also cannot open the saved file from within FF (even though FF opens it from the site just fine).

If I rename the file with just the .html extension, it opens normally.

AND--if I try to put it in the address line without the .gz, it gives me this:

Quote:
The HTML on this web site is compressed with gzip. A web browser which automatically decompresses these web pages is Mozilla. Note that old version of Internet Explorer do not perform this action. Loading will start in 5 seconds.
Conclusion: When I save the page, it is no longer compressed, but it keeps the .gz extension.

Solution: save and rename the file, or use Firefox/Mozilla
 
Old 01-19-2008, 02:53 PM   #6
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by pixellany View Post
This is weird: If I save the page to disk and then try to open it, it offers only to open with Ark. This fails, as does double-clicking. I also cannot open the saved file from within FF (even though FF opens it from the site just fine).

If I rename the file with just the .html extension, it opens normally.
It’s not that weird. The reason is that file extensions are immaterial to web browsing. Most likely, the file extension is there to tell the server how to treat the file. In this case, the .gz extension tells the server to use web compression to send the file if the client advertises itself with “Accept-Encoding: gzip” (which Mozilla browsers do). So the compressed content is transmitted by the server to the web browser where it is decompressed and interpreted as “Content-type: text/html” (all transparent to the user). When you try to “Save Page” through the webbrowser, the decompressed version will be saved, with whatever filename you chose (including file extension).

If you try to open the file later on (you are no longer web browsing, but file browsing), there is no server to tell the browser how to interpret the file (i.e., give it a Content-type). The only hint it has is the file extension (even if the extension misrepresents the file). So if you have an html text file with a different extension (e.g., .gz), the browser will assume (without looking at the contents of the file) that the MIME-type corresponds to that extension (e.g., application/x-gzip) instead of text/html.

If you try this sort of thing in something like wget, you will have to decompress the file yourself. E.g.,
Code:
$ wget http://rute.2038bug.com/index.html.gz
--15:52:40--  http://rute.2038bug.com/index.html.gz
           => `index.html.gz'
Resolving rute.2038bug.com... 196.15.148.250
Connecting to rute.2038bug.com|196.15.148.250|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20,378 (20K) [text/html]

100%[=============================================================================>] 20,378        25.72K/s             

15:52:42 (25.67 KB/s) - `index.html.gz' saved [20378/20378]

$ file index.html.gz
index.html.gz: gzip compressed data, was "T", from Unix, last modified: Fri Oct 19 17:28:13 2007
$ gunzip index.html.gz
$ file index.html
index.html: HTML document text
As you can see, the file is sent to be interpreted as text/html even though it is encoded with gzip.
 
Old 01-19-2008, 03:31 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
OK--replace "weird" with "I've never seen it before." (In thousands of hours of web browsing.)

Is the browser response to a g-zipped file in the W3C standards?

When Firefox saves a file with the .gz extension--but which is no longer a g-zip file--is that standards-compliant? If so, find me the people that maintain these standards.....
 
Old 01-19-2008, 05:14 PM   #8
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by pixellany View Post
OK--replace "weird" with "I've never seen it before." (In thousands of hours of web browsing.)
You probably have seen web compression, it’s just usually done completely transparently (e.g., even if the stream is compressed, you won’t notice any extensions in the URI).
Quote:
Originally Posted by pixellany View Post
Is the browser response to a g-zipped file in the W3C standards?
The browser (when browsing through http) doesn’t (or shouldn’t) have a clue of the file types corresponding to various paths (i.e., it shouldn’t try to interpret extensions). What it should do is send a request to the server (consisting mostly of a host and an absolute path), and interpret the response based on the entity headers (again not by looking at the extension). For example, if the headers indicate the Content-Type to be “application/x-gzip” with no Content-Encoding, then the browser should use its application/x-gzip handler (usually saving the file to disk or opening a temporary copy with an external program). This is what happens with most URIs which end in “.gz” (e.g., http://www.kernel.org/pub/linux/kern...-2.6.23.tar.gz). If the headers indicate the Content-Type to be “text/html” with a Content-Encoding of “gzip”, then the browser should decompress the stream and handle the result with the text/html handler (which is usually the browser itself). This is what happened with the RUTE URI. The choice of the headers themselves is made by the server (not the browser).

For example, some servers chose to send files which end in “.c” over as “text/plain”, and others chose to use “text/x-csource” or “application/octet-stream”. The difference often means the difference in a browser showing the contents of the file or opening up the default editor to show the contents. A similar thing happens for postscript files (e.g., if sent as “text/plain” you are shown the source code for the postscript file, but if sent as “application/postscript” it is opened by a postscript viewer). If I wanted, I could mismatch all the file extensions on my server, as long as I told you how to use them correctly. The only time the browser will try to read the extensions itself is when the Content-Type is given as “application/octet-stream”.

All this is in the “standards”. Mostly it is in the HTTP standard (RFC 2616).
Quote:
Originally Posted by pixellany View Post
When Firefox saves a file with the .gz extension--but which is no longer a g-zip file--is that standards-compliant? If so, find me the people that maintain these standards.....
Well on my firefox, this is what happens: I go to “File->Save Page As” and a subsequent save dialog is given. It asks me where to save it and what the filename should be. The default place to save it is my home directory, and the default filename is usually the basename of the absolute path portion of the URI. I don’t think the W3C or any other standards body cares what choice of default filename a browser uses. I am not even aware that the W3C mandates a browser to have “Save Page” functionality.
 
Old 01-20-2008, 12:56 AM   #9
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Also check this: http://httpd.apache.org/docs/2.2/mod/mod_deflate.html (for gzip compression)

Last edited by Alien_Hominid; 01-20-2008 at 12:57 AM.
 
Old 02-02-2008, 11:02 AM   #10
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Quote:
Originally Posted by pixellany View Post
AND--if I try to put it in the address line without the .gz, it gives me this:
Actually, that server has two different files.

One is named index.html, which contains 640 bytes of HTML that display the message you quoted.

The other is named index.html.gz, which is the 20378-byte gzip file.
 
Old 02-03-2008, 04:34 AM   #11
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
This LINK will get you the whole book so you can read it offline.
The BashFAQ
The BashGuide
 
  


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
Shell scripting guide / tutorial rockymaxsource Linux - General 6 06-01-2007 03:02 AM
Basic shell scripting help zipper777 Linux - Newbie 6 03-13-2006 12:58 PM
Basic bach scripting BruceC Linux - Newbie 4 02-25-2005 09:31 AM
very basic scripting question spatter9999 Programming 3 09-18-2003 01:36 AM
Basic BASH scripting question Dark_Helmet Programming 3 06-26-2003 05:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:36 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
Open Source Consulting | Domain Registration