Forum Moderators: open

Message Too Old, No Replies

I need help! please help (Shell Script)

         

mwaguya

4:41 am on Oct 19, 2004 (gmt 0)

10+ Year Member



I have no idea about writing ashell script. I need soembody to send me a sample script of a shell or command line with which an interractive user can send commands to the OS and by which the OS can respond by typing lines of characters back at the screen.

photon

1:17 pm on Oct 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi mwaguya--welcome to WebmasterWorld!

Which OS?

mwaguya

3:49 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



the OS I am using is Linux

nalin

3:57 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



The Bash Programming Introduction Howto [tldp.org] and Advanced Bash Scripting Guide [tldp.org] are very good resources for starting out and learning more respectivly.

Incedentally, when trying to do something under linux - the word "howto" will generally find good resources. Both those offically sanctioned, and those which are useful but obscure, are often titled as howtos or guides.

[edit added:]
Just to clarify there are a number of shell scripting languages available within linux (Bash, Csh, Ksh, and probably a handful I am missing). Bash (Bourne Again SHell) is by and large the most popular of them and the one in which 90% or so of the scripts you will see are written, therefore it is the one that will prove useful to learn, if not for its own merits then because it is relativly standard.

mwaguya

4:12 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



thanks a lot. Let me see how far I can get. One more question. If I am using C programming language to do this shell script, what major differences are there? Does anyone have a sample code for a command line written in C

nalin

4:45 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



There are different manners in which to use C, there is Csh which I am rather unfamiliar with (although there is likly a howto around), and then there is (compiled) C and C++.

For compiled variations there are a number of larger differences. The syntax of C is night and day from that of Bash, it would be akin to comparing english and, i dont know, lets say Sanskrit. Additionally, with C and C++ you write the code and then compile it using gcc or g++ (or one of the other compilers available such as Intels c compiler or dist CC which does compiling over a network of machines, gcc and g++ (the GNU C Compiler) are the more standard ones). This results in a binary file which one cannot edit, you execute the binary in a manner similar to executing the shell files.

Generally C is used for large type programs where execution speed is more of an issue then difficulty in creation. Bash scripts would be utilized for smaller type jobs where speed is not necessarily and where the tools built into most unix type os'es are capible of getting the job done.

For most web type development work (including learning the tools that will help one as a system administrator) bash in more suited then C.

mwaguya

12:42 am on Oct 21, 2004 (gmt 0)

10+ Year Member



I really appreciate the support. Thanks a lot