Unix Scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unix Scripting
# 1  
Old 08-07-2009
Unix Scripting

Hi Gurus,
I am a system admin in solaris field and ive planned to study unix scripting.ive planned to start reading Mastering Unix scripting by randal.Scripts in that are based on Korn shell(ksh).my question is whether the same scripts can be applied to other shells like bash etc..And also it will be very helpfull if someone can say whether to learn Unix scripting or a language like PERL.Thanks in Advance..Smilie
# 2  
Old 08-07-2009
Hi Madanmeer,

If you want to learn a scripting language that will work in most other shells, learn bourne (/sbin/sh). Bash and Korn (and many others) completely support all Bourne syntax. Bash and Korn add some addition functionality which is very handy but that means that some functions in them won't work with each other or Bourne.

If you intend to work entirely on Solaris, it's relatively safe to work in ksh but I always prefer to use Bourne if at all possible Smilie

I would also applaud your idea to look into Perl, it's a very useful language, but would suggest that you instead look into Python. I learned Perl and never got round to learning Python but I'm told by people who's opinion I value highly that it's superior to Perl.

In addition, try to get a basic understanding of sed and awk to assist your shell scripting. Awk in particular is very powerful and can do a great deal on it's own, but even if you only learn how to search and print with it, it'll help you greatly.

Whatever you decide, good luck in your endevour and feel free to drop by and ask us if you get stuck on anything Smilie
# 3  
Old 08-07-2009
Hi Smiling Dragon,

Thank u for ur response.Actually as of now to be frank im very confused to wat to opt n study.Ive heard people say that scripting is important for sys admins.im a fresher n workin now with an expierience of just 6 months in solaris.i need to kno the rite path in this field.so once i start learning any scripting i must try to complete it properly.For sure im gona stay in unix field so do advise me bout how to aproach..Thanks in Advance.
# 4  
Old 08-07-2009
On any POSIX compliant unix such as HP-UX "sh" will start the POSIX shell (not the old Bourne shell as it used to). Unless you will be working on old systems there is little use for Bourne shell nowadays though it is good background knowledge to know when you are using a shell extension relative to Bourne shell.
Personally I find Korn shell "ksh" to be the most portable in unix and "bash" the most portable in Linux. The least useful is C shell "csh".
# 5  
Old 08-07-2009
I used to think that learning Bourne shell (sh) is the most portable and safest in scripting writing. That may be true in the past. Nowadays, I hardly see UNIX system without ksh or even bash shell. In some situations, you will find Bourne shell is pretty inefficient because one has to rely on external commands to achieve certain actions. Spawning process is considered very experience. Imagine you need to spawn processes in a few thousand times. ksh and bash have special syntax to help to achieve common tasks without spawning.

As for Perl or Python ? It is really up to one's taste. IMO, it is not about the language, it is all about how clear you can use the language to do the work. If a language can last that long, it definitely has some value.

Both Perl and Python have a lot of libraries and utilities available on the web, no need to reinvent the wheel. However, if you always depend on this, you will not be able to invent your own wheel.

Shell scripting intro is a good intro, IMO

Last edited by chihung; 08-07-2009 at 12:10 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX scripting

LIST=/home/xxxxxxx/ABC/xeeno_scrpts/temp/tempfile ERRORDIR=/home/xxxxxxx/ABC/error_directory EMAILFILE=/home/xxxxxxx/ABC/xeeno_scrpts/temp/emailfile echo "There were errors in the following report file for Xeenos:" > $EMAILFILE echo >> $EMAILFILE echo "This files have been moved to... (9 Replies)
Discussion started by: bcarosi
9 Replies

2. UNIX for Dummies Questions & Answers

Unix Shell Scripting( Calling from Unix to PLSQL)

Hello Experts, I have the following questions to be discussed here at this esteemed discussion forum. I have two Excel sheets which contain Unix Commands llike creating directory the structure/ftp/Copy/Zip etc to basically create an environment. I need help in understanding some of... (1 Reply)
Discussion started by: faizsaadq
1 Replies

3. UNIX for Advanced & Expert Users

Unix scripting

i need help with this problem this is the problem: Write a script that logs how many users login on/off the system over a 5 minute period. It can run in the foreground, and run 4 times a minute. Set a trap that will not allow a CNTRL-C command, and if a CNTRL-C is excuted store the time and date... (1 Reply)
Discussion started by: sportsmansixty6
1 Replies

4. Shell Programming and Scripting

Unix scripting

how to check if a unix script gets executed without errors across all unix platforms. incase if a script gets executed without errors only one platform say AIX, what needs to be done to that script such that it will run all unix platforms like linux, hp, sun etc (2 Replies)
Discussion started by: rmann
2 Replies

5. UNIX for Dummies Questions & Answers

Unix Scripting

Hi Gurus, I am a system admin in solaris field and ive planned to study unix scripting.ive planned to start reading Mastering Unix scripting by randal.Scripts in that are based on Korn shell(ksh).my question is whether the same scripts can be applied to other shells like bash etc..And... (1 Reply)
Discussion started by: madanmeer
1 Replies

6. UNIX for Dummies Questions & Answers

Help me Out in unix scripting

Hello every one, plz help me out. I m using 4 files in unix, like file1, file2, file3,file4 in which primary key is ID in column(field) of 4 files. On the bases of ID, i want the corresponding field of 4 files in final file let say collected file. In collected file, ID column should occur only one... (16 Replies)
Discussion started by: kaprus
16 Replies

7. UNIX for Dummies Questions & Answers

Unix scripting pl help

Hi All, I am new to Unix Scripting. I have below scenario. I need to write a Unix function with the following. 1. I have table. From this table I need to write a query. SELECT Col1(File_nm),Col2(From_Loc),Col3(To_Loc) FROM A WHERE CONDITION For... (1 Reply)
Discussion started by: sree11
1 Replies

8. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

9. UNIX for Dummies Questions & Answers

Help With Unix Scripting.

Can anybody tell me the best way to learn unix scripting.can you recommend a good book.Please help! (1 Reply)
Discussion started by: hella
1 Replies

10. UNIX for Dummies Questions & Answers

UNIX Scripting

:confused: I need to find a place or places on the Internet where I can find UNIX scripts to view and to modify to make life easy on the UNIX environment. Can someone help me on this. Thanks (7 Replies)
Discussion started by: wolf
7 Replies
Login or Register to Ask a Question