Sponsored Content
Top Forums Shell Programming and Scripting Best way to learn UNIX and shell Programming Post 302552669 by kermit on Monday 5th of September 2011 05:35:05 AM
Old 09-05-2011
Disclaimer: I am not a professional UNIX guy - I work in a completely different field.

From my perspective, the number one most helpful thing you can do is to be constantly coding. This is particularly helpful if you have a need (or at least desire) some particular behaviour in your system. For example, I had a buggy program, and sometimes would need to kill several instances of it. It was a pain to do a `ps -A` every time, and manually kill each instance of the process. So I made a one-line script that would do a ps -A, grep for the name of the particular process, parse and grab the pid from the first field, and then do a kill on those numbers. Over time, I polished and extended the script, adding functionality, and making the output a little more informative/easier to read.

Now there a few things to note here:
  1. At the time, I did not know of pkill and friends, so I was basically reinventing the wheel. As I look back, that was OK, because I learned something while doing it. In fact, it is a decent way to learn. You basically take a known utility that you normally use, eg., pkill, or whatever, and re-implement it yourself. At first, your new program likely won't have all of the functionality of the full blown version on your system, but you can add that over time. This concept is also helpful in other areas, such as C programming. It is very instructive, for example, to make your own versions of the string library functions. Not for actual use necessarily, but for learning. (It is hard to beat the system versions, in terms of outright speed. If you already know enough to improve on the standard library, then my points here are basically moot.)
  2. If the process of learning how to shell program seems to be coming slowly, remember to be patient with yourself, and stick with it. Everybody's situation is different. For my part, I am a slow learner (it seems), and I have been hacking away for years and am not nearly as far as others have gotten in the same time. If I was doing this for a living, I know I would be farther along, because a), I would be immersed in it, and b) I would (ostensibly) have other professionals to guide me when I was doing something that was not quite right. This is true of mostly any profession I think. There is a huge learning curve with this sort of thing - lots of nooks and crannies. Be patient!

So that is my two cents worth. Write lots of code. It would be preferable to be writing some useful little stuff which improves some particular situation of your own (as opposed to toy exercises, which initially can be somewhat helpful, but are ultimately limited in value). If you are like me, you likely want to grab an O'Reilly book on scripting, or something like that as well. Ask lots of questions as well.
 

10 More Discussions You Might Find Interesting

1. Programming

Want To Learn Network Programming

I want to learn Network Programming with C,but I don't know how to start. Thank you. (2 Replies)
Discussion started by: hubin330
2 Replies

2. UNIX for Dummies Questions & Answers

Programming/Scripting Languages To Learn

Which languages would, in the long run, be best to learn on a UNIX environment for kernel work, every day programs, and overall UNIX programming? I've been learning C for over a year now (which I'm pretty confident with) and decided I want to look into some other languages. I'll mainly be... (1 Reply)
Discussion started by: tjinr
1 Replies

3. Web Development

What Web Development languages should i learn?

I am learning Web Development, so far i am learning html,xhtml, css, java script.... What I want to know is what other Web Development languages should i learn? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

4. What is on Your Mind?

How can I learn computer programming languages on my own?

I would love the idea to develop games. How can I teach myself computer programming? What programs or software must I use? I have the new iMac? (5 Replies)
Discussion started by: Anna Hussie
5 Replies

5. UNIX for Dummies Questions & Answers

How does unix system administration, unix programming, unix network programming differ?

How does unix system administration, unix programming, unix network programming differ? Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies

6. UNIX for Dummies Questions & Answers

Open-source projects to learn concurrency-managed network programming in Unix?

Hi, I am a mid-career programmer with extensive experience in object-oriented design and development in C, C++, and C#. I've written a number of multi-threaded server applications and background services, although my grasp of networking protocols is a bit weak: my current job drifted away from... (2 Replies)
Discussion started by: TheTaoOfPhil
2 Replies

7. Shell Programming and Scripting

Need a good book to learn UNIX Shell Scripting

I'm going to be starting a job in a month or so that I need to brush up on my Unix shell scripting skills. About 15 years ago, I took a college class for Unix shell scripting. I would like to find a good college book again, rather than just going to Amazon and just buying anything. This is... (2 Replies)
Discussion started by: dorlow
2 Replies

8. Shell Programming and Scripting

How to learn UNIX shell scripting?

Hi Guys, I know basic command of unix and basic programming of unix as like using for loop, while loop, if..else, case statement etc. then how to learn unix shell scripting as well as use also. (1 Reply)
Discussion started by: aaditya321
1 Replies

9. Shell Programming and Scripting

Help for programming a UNIX Shell in C++

Hello! :) I currently got the task of programming a UNIX Shell for practice. The functionality is as follows: 1. Entering commands with the keyboard. Enter stops the input and creates a process which should start any program 2. the shell waits for termination of each command before... (1 Reply)
Discussion started by: DarkDan
1 Replies

10. UNIX for Beginners Questions & Answers

Wanna learn native GUI programming in UNIX - Linux ?

Hi , wanna learn native GUI programming in Unix-Linux instead of Gtk and Qt. No problem. You don't need a cross platform Gui toolkit like Gtk and Qt. And the code and syntax is also not more or less than others. Check out this code for a simple mainwindow for your application that is openend in... (0 Replies)
Discussion started by: Sennenmut
0 Replies
sh(1)							      General Commands Manual							     sh(1)

NAME
sh - Shell, the standard command language interpreter DESCRIPTION
[Tru64 UNIX] Tru64 UNIX provides two command interpreters with the name sh. The XCU5.0 and POSIX.2 compliant command interpreter sh is available in the file /usr/bin/posix/sh and is described in the sh(1p) reference page. The Bourne shell, historically known as sh, is available in the file /usr/bin/sh and is described in the sh(1b) reference page. [Tru64 UNIX] Your initial, or login, shell is determined by your entry in the file /etc/passwd. This file can be changed only by your sys- tem administrator. You must use whatever procedures are in place at your location to have this entry changed. [Tru64 UNIX] If available on your system, you may use the passwd -s or the chsh commands to change your login shell. Note This option is not available if your site manages passwords through the Network Information Service (NIS) facility. Check with your system administrator. [Tru64 UNIX] Subsequent shells spawned from the initial shell depend on the value in the environment variable BIN_SH. If this variable is set to xpg4, the POSIX shell is started. If this variable is set to svr4, an SVR4 compliant version of the shell is started. If this vari- able is unset, the Bourne shell is started. If this variable is set to any other value, an error is reported and the results are unpre- dictable. See the EXAMPLES section for information on setting this variable. NOTES
[Tru64 UNIX] With Tru64 UNIX Version 4.0 the Korn shell, /usr/bin/ksh is the same as the POSIX shell /usr/bin/posix/sh. RESTRICTIONS
[Tru64 UNIX] The file /etc/shells must include entries for both the POSIX shell /usr/bin/posix/sh and the Bourne shell, /usr/bin/sh. If this file is incorrect, see your system administrator. EXAMPLES
Using the Bourne, Korn, or POSIX shell, to set the variable BIN_SH to use the POSIX/ XCU5.0compliant shell, enter: BIN_SH=xpg4 export BIN_SH Using the Bourne, Korn, or POSIX shell, to set the variable BIN_SH to use the SVR4 compliant shell, enter: BIN_SH=svr4 export BIN_SH Using the Bourne, Korn, or POSIX shell, to unset the variable BIN_SH, enter: unset BIN_SH Using the C/ shell, to set the variable BIN_SH to use the POSIX/XCU5.0 compliant shell, enter: setenv BIN_SH xpg4 Using the C/ shell, to set the variable BIN_SH to use the SVR4 compliant shell, enter: setenv BIN_SH svr4 Using the C/ shell, to unset the variable BIN_SH, enter: unsetenv BIN_SH FILES
User profile. Contains user information, including the login shell name. Contains the names of available and permitted shells. SEE ALSO
Commands: csh(1), ksh(1), Bourne shell sh(1b), POSIX shell sh(1p), passwd(1) Files: passwd(4), shells(4) Standards: standards(5) sh(1)
All times are GMT -4. The time now is 10:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy