Exforsys

Free Training

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 ...

Go Back   Exforsys > Operating Systems > Shell Programming

Exforsys.com

  #1 (permalink)  
Old 04-27-2006, 05:35 AM
Junior Member
 
Join Date: Apr 2006
Posts: 7
alexei is on a distinguished road
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-20-2007, 03:18 PM
Senior Member
 
Join Date: Apr 2006
Posts: 141
Adrian is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-20-2007, 03:30 PM
Senior Member
 
Join Date: Apr 2006
Posts: 125
ashlee is on a distinguished road
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-20-2007, 03:36 PM
Senior Member
 
Join Date: Apr 2006
Posts: 162
sammy is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-21-2007, 09:22 AM
Junior Member
 
Join Date: Feb 2007
Posts: 1
ftoyosi is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Getting Started With Java Programming !! insane Java Tutorials 7 04-26-2006 03:19 PM
C Programming - Decision Making - Branching JobHelper Career Advice 0 04-15-2006 12:31 PM
Windows Vista : Programming Indigo: The Programming Model techguru Windows Vista Tutorials 0 08-27-2005 05:00 AM
Position C/C++,HP-UX, Shell Script kalareddy Experienced Job Seekers - India 0 06-07-2005 08:46 AM
Software Professionals - Fresher - C, C++, UNIX Shell Scripting techguru Freshers Jobs 0 05-31-2005 10:20 PM


All times are GMT -4. The time now is 12:09 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Copyright 2004 - 2009 Exforsys Inc. All rights reserved.