Wednesday, June 18, 2014

Shell Scripting in detail

Hello everybody! do u know, creating virus using scripting language is very simple . try to make more scripting virus and use it for attack. 

today i'm going to tell you in detail about shell scripting 

the first thing about #!/bin/bash what does it mean actually?
Is there any difference between sh and bash?

So here it is:-

older flavors of ATT defaulted to "sh" (the Bourne shell), while older versions of BSD defaulted to "csh" (the C shell).Even today (where most systems run "bash", the "Bourne Again Shell"), scripts can be in bash, python, perl, ruby, PHP, etc, etc. For example, you might see "!/bin/perl" or "/bin/perl5".

PS: The exclamation mark ("!") is affectionately called "bang". The shell comment symbol ("#") is sometimes called "hash".

PPS: Remember - under *nix, associating a suffix with a file type is merely a convention, not a "rule". An "executable" can be a binary program, any one of a million script types and other things as well. Hence the need for "#!/bin/bash".

And ans is yes for 2nd question:-

 When you tell #!/bin/bash then you are telling your environment/ os to use bash as a command interpreter. This is hard coded thing.Every system has its own shell which the system will use to execute its own system scripts. This system shell can be vary from OS to OS(most of the time it will be bash. Ubuntu recently using dash as default system shell). When you specify #!/bin/sh then system will use it's internal system shell to interpreting your shell scripts.

How it works ? we will see this afterwords.