An email is sent to Sherin
    • home
    • user
    • contact
    • +91-9847999194
    • Home
    • Feedback
    • Gallery
    • Contact Me
    • Bookmark

    SHELL SCRIPTING

    SCRIPTING

        SIMPLE SCRIPTING 

    SHELL SCRIPTING
    ***************
    
    Shell scripting can be simply defined as a group of commands executed in sequence.
    
    
    Each step by step is given below:
    
    Step 1: Open the file using an editor (e.g., "vi" or "pico".)
    
    vi Firstshellscript.sh
    
    Step 2:All shell scripts should begin with "#!/bin/bash" or whatever other shell 
    you prefer. This line is called the shebang, and although it looks like a 
    comment, it's not: it notifies the shell of the interpreter to be used for 
    the script. The provided path must be an absolute one (you can't just use 
    "bash", for example), and the shebang must be located on the first 
    line of the script without any preceding space.
    
    Step 3: Write the code that you want to develop. Our first 
    shell script will be the usual "Hello World" routine, which
     we'll place in a file called 'Firstshellscript.sh'.
    
    #!/bin/sh
    echo "Hello World"
    
    Step 4:The next step is to make the script executable by using the "chmod" command.
    
    chmod 744 Firstshellscript.sh
    
    or
    
    chmod +x Firstshellscript.sh
    
    Step 5: Execute the script. This can be done by entering the name of the 
    script on the command line, preceded by its path. If it's in the current directory, 
    this is very simple:
    
    bash$ ./Firstshellscript.sh
    Hello World
    
    If you want to see the execution step-by-step - which is very useful for 
    troubleshooting - then execute it with the '-x' ('expand arguments') option:
    
    sh -x Firstshellscript.sh
    + echo 'Hello World'
    Hello World
    
    Category: Shell scripting
    Shell scripting can be defined as a group of commands executed in sequence.
    
    To see the contents of a script, you can use the 'cat' command or 
    simply open the script in any text editor:
    
    bash$ cat Firstshellscript.sh
    #!/bin/sh
    echo Hello World
    
    Comments in a Shell
    
    In shell scripting, all lines beginning with # are comments.
    
    # This is a comment line.
    # This is another comment line.
    
    You can also have comments that span multiple lines by using a colon and single quotes:
    
    : 'This is a comment line.