Active Members
TodayLast 7 Daysmore...


Ask Experts » Computers » Software »

What is the better way of unix shell scripting?

Date: 09 Apr 2009   Group: Computers    Category: Software   


Anbody please suggest me some better way to learn unix shell scripting....


Find Answers

Author: gopi    09 Apr 2009      Member Level: Silver     Points : 2    Voting Score: 0
Hi Friend if you are familiar with Dos commands then thats enough to learn unix commands and shell scripts that run through those unix commands. Just compare the attributes of Dos commands with Unix commands u will find it easier to learn. This is the best way of learning any new type of language r os in computers.
Author: Sarassou    20 May 2009      Member Level: Silver     Points : 2    Voting Score: 0
Hi,

First learn the unix commands. There are commands specific to Shell like bourne, cshell etc. Then open a file with vi editor. Add the location of the shell for example "#!/bin/sh" as the first line. Then you can add one command in each line or commands separated by semicolon. There are also conditional statements available. Save the file and exit. Set the file permissions for execution. For example using "chmod 777 " gives all permissions. Then issue ./ from the current directory in which the file is present.

This just gives you the overview. Do google, you will get lot of tutorials on this.




Author: Shashikant Gupta    22 May 2009      Member Level: Gold     Points : 2  (Rs 2)    Voting Score: 0
Well if you are already aware of Unix commands, then go through the 9th chapter of the ebook at below given ISC Resource Link for shell programming in UNIX.

If you are new to unix then you need to start from the basics. You really need to learn various unix commands and only then you should proceed with UNIX Shell scripting.

You follow this path to head towards shell scripting;

1) Directory and file listing commands
2) File related commands like moving, copying,deleting, renaming, etc
3) Remote login, remote copying of file across hosts, etc
4) Commonly used functions like sorting, searching files, editing contents of the file in VI,comparing two files etc

You should practise commands thoroughly to be comfortable in using unix and then you should proceed with Shell scripting.

Unix Ebook - shell programming

Regards,
Shashikant S. Gupta,
(Software Engineer + ISC Gold Member)

Author: Sunny    30 May 2009      Member Level: Bronze     Points : 2  (Rs 2)    Voting Score: 0
I am Di scribing Some Command you may practice on this
1 sort Sorts lines in ascending, descending and unique order
2 grep Searches for regular expressions in strings or files
3 basename Strips the path from a path string to leave just the filename
4 dirname Removes the file from a path string to leave just the pathname
5 cut Chops up a text string by characters or fields
6 wc Count the characters, words, or lines
6 [ (test) ] Predicate or conditional processor
7 tr 'a' 'b' Transform characters
8 expr Simple arithmetic processor
9 bc Basic Calculator
10 eval Evaluate variables
11echo Output strings
12 date Create date strings
13 nawk Manipulate text strings
14 head | tail Access lines in files

Note:- Use Help Command for Find other assistance in these command.

Regards
Devesh Kumar
M.Sc (Computer Science)

Author: rupesh    19 Jun 2009      Member Level: Bronze     Points : 2    Voting Score: 0
sort Sorts lines in ascending, descending and unique order
grep Searches for regular expressions in strings or files
basename Strips the path from a path string to leave just the filename
dirname Removes the file from a path string to leave just the pathname
cut Chops up a text string by characters or fields
wc Count the characters, words, or lines
[ (test) ] Predicate or conditional processor
tr 'a' 'b' Transform characters
expr Simple arithmetic processor
bc Basic Calculator
eval Evaluate variables
echo Output strings
date Create date strings
nawk Manipulate text strings
head | tail Access lines in files

Author: Santosh    19 Jun 2009      Member Level: Gold     Points : 2  (Rs 2)    Voting Score: 0
Hi,

Please buy the book on Unix Shell Programming by Yeshwanth Kanetkar, BPB Publications. It is wonderful book. It has most of the commands and options used in Unix Programming. It has very good examples too. Once, you understand the book, try to implement the exercies given in it. Use, Ubuntu Linux Operating System. You can use these commands in it.


If you have anymore doubts, please feel free to ask me.

Best Regards,
Santosh Kumar T
(Editor, IndiaStudyChannel)
visit my website indiarockz.com

Author: vijay nemiwal    26 Jun 2009      Member Level: Silver     Points : 2    Voting Score: 0
Well if you are already aware of Unix commands, then go through the 9th chapter of the ebook at below given ISC Resource Link for shell programming in UNIX.

If you are new to unix then you need to start from the basics. You really need to learn various unix commands and only then you should proceed with UNIX Shell scripting.

You follow this path to head towards shell scripting;

1) Directory and file listing commands
2) File related commands like moving, copying,deleting, renaming, etc
3) Remote login, remote copying of file across hosts, etc
4) Commonly used functions like sorting, searching files, editing contents of the file in VI,comparing two files etc

You should practise commands thoroughly to be comfortable in using unix and then you should proceed with Shell scripting.

Author: ravi    26 Jun 2009      Member Level: Silver     Points : 2    Voting Score: 0
You follow this path to head towards shell scripting;

1) Directory and file listing commands
2) File related commands like moving, copying,deleting, renaming, etc
3) Remote login, remote copying of file across hosts, etc
4) Commonly used functions like sorting, searching files, editing contents of the file in VI,comparing two files etc

You should practise commands thoroughly to be comfortable in using unix and then you should proceed with Shell scripting.

Author: mahaswetadas    28 Jun 2009      Member Level: Silver     Points : 2    Voting Score: 0
Hi,

Find the link for learn Shell scripting..

http://www.tinker.ncsu.edu/LEGO/shell_help.html


My Blog:-
  • http://stockexchangesinindia.blogspot.com/

  • My ISC Community:-
    Join Here

    Thanks,
    -Mahasweta
    Stock Market Analysis



    Author: peeyush jain    01 Jul 2009      Member Level: Silver     Points : 4  (Rs 2)    Voting Score: 0
    Unix uses shells to accept commands given by the user, there are quite a few different shells available. The most commonly used shells are SH(Bourne SHell) CSH(C SHell) and KSH(Korn SHell), most of the other shells you encounter will be variants of these shells and will share the same syntax, KSH is based on SH and so is BASH(Bourne again shell). TCSH(Extended C SHell) is based on CSH.
    http://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/unixscripting/unixscripting.html
    http://steve-parker.org/sh/sh.shtml
    http://www.vtc.com/products/Unix-Shell-Scripting-Advanced-tutorials.htm


    i have done some good knowledge of script if you want to know some specific then let me know your problem statement.

    Author: Vipin lal    04 Jul 2009      Member Level: Silver     Points : 5  (Rs 4)    Voting Score: 0
    Learning Unix shell scripting is not that difficult you think.You can get very good tutorials from internet which explains step by step shell programming.
    The following steps may help you in learning shell scripting:

    1)Learn the general use of the following commands.
    man- information about a particular command
    ls - list contents of a particular directory
    cd - change directory
    pwd - shows present working directory
    rm or rmdir - deleting files or directories
    cp - copying files or directories
    echo - displaying a variable or text
    cat - concatenate files


    2)There are many type of shells like
    Bourne shell (sh)
    Korn shell (ksh)
    Bourne Again shell (bash)
    POSIX shell (sh)

    Normally people use bash which is default in many unix systems.

    3)The first line in your program should be the following
    #!/bin/sh

    4)'#' means the following line is a comment.

    5)$ denotes a variable.

    6)There are normal flow statements and conditional statements in shell scripting similar to C.they are very easy to use.

    If statement:

    if list1
    then
    list2
    elif list3
    then
    list4
    else
    list5
    fi


    While statement:

    while command
    do
    list
    done

    For loop:

    for name in word1 word2 ... wordN
    do
    list
    done


    7)Learn these 3 instructions, and you will be able to write a descent shell script.

    8)Another thing is that you should name your file with an extension .sh

    9)Make the file executable by typing chmod 777 in the terminal.
    Otherwise the program will not run

    This is just an introduction to shell scripting.Don't forget Google for more detailed information.


    Regards
    vipin

    Author: kalpana viche    09 Jul 2009      Member Level: Bronze     Points : 2    Voting Score: 0
    Now a days mostely used unix shell scripting.unix shell scripting is same as dos command. if you know dos commend, you can use unix shellscripting. Learning Unix shell scripting is not that difficult you think.You can get very good tutorials from internet which explains step by step shell programming.
    The following steps may help you in learning shell scripting:

    1)Learn the general use of the following commands.
    man- information about a particular command
    ls - list contents of a particular directory
    cd - change directory
    pwd - shows present working directory
    rm or rmdir - deleting files or directories
    cp - copying files or directories
    echo - displaying a variable or text
    cat - concatenate files


    2)There are many type of shells like
    Bourne shell (sh)
    Korn shell (ksh)
    Bourne Again shell (bash)
    POSIX shell (sh)

    Normally people use bash which is default in many unix systems.

    3)The first line in your program should be the following
    #!/bin/sh

    4)'#' means the following line is a comment.

    5)$ denotes a variable.

    6)There are normal flow statements and conditional statements in shell scripting similar to C.they are very easy to use.

    If statement:

    if list1
    then
    list2
    elif list3
    then
    list4
    else
    list5
    fi


    While statement:

    while command
    do
    list
    done

    For loop:

    for name in word1 word2 ... wordN
    do
    list
    done


    7)Learn these 3 instructions, and you will be able to write a descent shell script.

    8)Another thing is that you should name your file with an extension .sh

    9)Make the file executable by typing chmod 777 in the terminal.

    Answers      





    Post answer or solution to "What is the better way of unix shell scripting?"

    You can earn revenue online from Google AdSense and our revenue sharing programs by post valid, self written answers for the problem What is the better way of unix shell scripting?




    You must Sign In to post a response.


    Next Question: software counterfieting
    Previous Question: Boot loader problem
    Return to Question Index
    Ask Question to Expert
    Category:


     
    Related Questions
    Popular Tags   What are tags ?   Search Tags  
    (No tags found.)
    Awards & Gifts
    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.