Getting started with shell

Other topics

Remarks:

This section provides an overview of what shell is, and why a developer might want to use it.

It should also mention any large subjects within shell, and link out to the related topics. Since the Documentation for shell is new, you may need to create initial versions of those related topics.

Installation or Setup

A command shell is a command line interface computer program to an operating system.

Some Variants

1. Bash : Comes as default shell on ubuntu

2. KornShell(ksh) :

To install ksh in Ubuntu

   $ sudo apt-get install ksh

To start working with ksh

    $ ksh
    $ ps $$
      PID TTY      STAT   TIME COMMAND
      4187 pts/2    S      0:00 ksh

Enter the commands at the ksh prompt

3. csh :

To install csh in Ubuntu

    $ sudo apt-get install csh

To work with csh, go to the command line and enter csh

    $ csh
    %

Hello World

At the command prompt:

$ echo "Hello World"

Output:

Hello World

To create a script, create a text document with the following content:

#!/bin/sh
echo "Hello World"

Save the script with the name hello.sh (or any filename) and make the script executable by giving the following permission:

$ chmod 755 hello.sh

Or:

$ chmod +x hello.sh

Run the script:

$ ./hello.sh

Output:

Hello World

To run a local shell script without executable permission:

1.bash

$ bash hello.sh
Hello World

2.ksh

$ ksh hello.sh
Hello World

3.sh

$ sh hello.sh
Hello World

Contributors

Topic Id: 1068

Example Ids: 3431,13909

This site is not affiliated with any of the contributors.