Exforsys
+ Reply to Thread
Results 1 to 5 of 5

Shell programming

This is a discussion on Shell programming within the Shell Programming forums, part of the Operating Systems category; How can I manually program the shell? It would be interesting to write some custom scripts for me. Anyone expert ...

  1. #1
    alexei is offline Junior Member Array
    Join Date
    Apr 2006
    Answers
    6

    Shell programming

    How can I manually program the shell? It would be interesting to write some custom scripts for me. Anyone expert on this? Thanks!


  2. #2
    Adrian is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    124
    Shell scripting is necessary for automating a broad range of administration tasks on servers related to UNIX and Linux Operating system. These scripts can be run manually to combine many steps into a single command. I have given below a simple shell script written manually to replace the command
    find . -name file -print


    % cd ~/bin
    % emacs sfind
    % page sfind
    find . -name $1 -print
    % chmod a+x sfind
    % rehash
    % cd /usr/local/bin
    % sfind tcsh
    ./shells/tcsh


  3. #3
    ashlee is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    108
    So is it that shell scripts are multiple commands which are entered manually by user at a command line interface. From the above I get the idea that shell scripts are executable files. Am I right?


  4. #4
    sammy is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    145
    I have given below some hints and guidelines for you to try the shell scripting progra suggested by our friend. These are the steps needed to write and execute a shell script.
    * Open the file using an editor like "vi"
    like vi sfind.sh
    * All shell scripts should begin with "#!/bin/bash" that is as given in the example depending upon the shell used by user.
    * Write the script fully in the file opened
    * The next step is to make the script executable by using the "chmod" command.
    as done in the example as
    % chmod a+x sfind
    * Then execution of script is done by entering the name of the script on the
    command line, preceded by its path. If it is current directory then
    ./followed by shell filename.sh would suffice.

    Try and let us know whether you were successful in running the script.


  5. #5
    ftoyosi is offline Junior Member Array
    Join Date
    Feb 2007
    Answers
    1

    Unix is the Best

    Alexia,

    The most interesting thing with Unix O/S is the scripting aspect of it. U can manually write scripts that does so many things u can imagine.


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...