Shell Script HELP!

General software, Operating Systems, and Programming discussion.
Everything from software questions, OSes, simple HTML to scripting languages, Perl, PHP, Python, MySQL, VB, C++ etc.
Post Reply
User avatar
One Sick Tzim
Member
Posts: 50
Joined: Fri Dec 10, 2004 4:17 am
Location: /dev/null

Shell Script HELP!

Post by One Sick Tzim »

Can anyone direct me to a website/howto/faq/guide on Unix/Linux Shell Scripting? I want to learn how to do it but just need a point in the right direction. Thanks!
One Sick Tzim

Dell Dimension 4550
Intel Pentium 4 2.53 GHz
256 MB DDR SDRAM 333 MHz
NVidia GeForce2 MX 64 MB
Windows XP SP2


Dell Axim X3
Blackberry 6710

And just in case anyone has any idea what I am talking about: My first computer was a Unisys!
;)
cyberskye
Senior Member
Posts: 4717
Joined: Wed Jan 10, 2001 12:00 am
Location: DC

Post by cyberskye »

One Sick Tzim wrote:Can anyone direct me to a website/howto/faq/guide on Unix/Linux Shell Scripting? I want to learn how to do it but just need a point in the right direction. Thanks!

Which shell? Some like C as the syntax is closer to the C language. I am a solaris guy so I learned Ksh. I believe BASH (bourneagainshell) is the default on most distros.

http://www.linuxdocs.org/HOWTOs/Bash-Pr ... HOWTO.html
anything is possible - nothing is free

:wth:
Blisster wrote:It *would* be brokeback bay if I in fact went and hung out with Skye and co (did I mention he is teh hotness?)
:wth:
cyberskye
Senior Member
Posts: 4717
Joined: Wed Jan 10, 2001 12:00 am
Location: DC

Post by cyberskye »

BTW - I just googled for that - pages of hits. Google is you friend.
anything is possible - nothing is free

:wth:
Blisster wrote:It *would* be brokeback bay if I in fact went and hung out with Skye and co (did I mention he is teh hotness?)
:wth:
User avatar
One Sick Tzim
Member
Posts: 50
Joined: Fri Dec 10, 2004 4:17 am
Location: /dev/null

Post by One Sick Tzim »

Was using BASH. I think.

Thanks!
One Sick Tzim

Dell Dimension 4550
Intel Pentium 4 2.53 GHz
256 MB DDR SDRAM 333 MHz
NVidia GeForce2 MX 64 MB
Windows XP SP2


Dell Axim X3
Blackberry 6710

And just in case anyone has any idea what I am talking about: My first computer was a Unisys!
;)
cyberskye
Senior Member
Posts: 4717
Joined: Wed Jan 10, 2001 12:00 am
Location: DC

Post by cyberskye »

You're welcome.

As another piece of advice - I used shell scripts for complex (multiple steps) tasks that I did often - stuff I would normally do at the command line (move, rename files, etc)

For more complex tasks, perl is a much mroe power scripting language - it is also more complicated, but if I were going to start all over again, I would have gone with perl from the beginning. http://www.perl.org/

As with all things, it depends on what you want to accomplish.
anything is possible - nothing is free

:wth:
Blisster wrote:It *would* be brokeback bay if I in fact went and hung out with Skye and co (did I mention he is teh hotness?)
:wth:
cyberskye
Senior Member
Posts: 4717
Joined: Wed Jan 10, 2001 12:00 am
Location: DC

Post by cyberskye »

One Sick Tzim wrote:Was using BASH. I think.

Thanks!
At a prompt, type ps

you should see two lines - your shell and then the command " ps " (cuz you just ran it :)

I don't know what you plan on doing in bash, but would strongly recommend you broaden your sysadmin skills first - since those tasks are the same ones you tend to write shell scripts for.

Cheers,

Skye
anything is possible - nothing is free

:wth:
Blisster wrote:It *would* be brokeback bay if I in fact went and hung out with Skye and co (did I mention he is teh hotness?)
:wth:
User avatar
One Sick Tzim
Member
Posts: 50
Joined: Fri Dec 10, 2004 4:17 am
Location: /dev/null

Post by One Sick Tzim »

So... I need to brush up - a lot - on my sysadmin skills. THEN learn Perl and/or scripting?
One Sick Tzim

Dell Dimension 4550
Intel Pentium 4 2.53 GHz
256 MB DDR SDRAM 333 MHz
NVidia GeForce2 MX 64 MB
Windows XP SP2


Dell Axim X3
Blackberry 6710

And just in case anyone has any idea what I am talking about: My first computer was a Unisys!
;)
cyberskye
Senior Member
Posts: 4717
Joined: Wed Jan 10, 2001 12:00 am
Location: DC

Post by cyberskye »

It really depends on what you want to do.

Shell scripts are pretty basic, and as their name implies, are appropriate for functions that you would perform at a shell prompt. If you have a good feel for the commands that are available to you at a prompt, shell scripting is pretty easy to learn.

Perl is more powerful and has similar syntax to C (you could actually write a webserver in perl; though it would be slow). Perl is the king of regular expressions (great for making mass changes to text files, etc. Php is based on perl.

It all depends on why you wanted to learn shell programming in the first place. Look to the result you want, then work backwards to find the best tool for the job. If you can answer that question I can help you find a good place to start.

Skye
anything is possible - nothing is free

:wth:
Blisster wrote:It *would* be brokeback bay if I in fact went and hung out with Skye and co (did I mention he is teh hotness?)
:wth:
User avatar
greEd
Posts: 807
Joined: Wed May 09, 2001 12:00 am
Location: Maryland

Post by greEd »

Another way to see your current shell:

echo $SHELL

regards,
greEd
"I'm doing a (free) operating system (just a hobby, won't be big and professional...) for AT clones... It's not portable and it probably [won't ever] support anything other than AT hard disks, as thats all I have :-(." --Posted on Usenet August 1991 by Linus Trovalds
http://www.computerglitch.net
curiosity builds security | dd if=/dev/zero of=/dev/hda bs=512 count=100
EOF
Post Reply