How To Create Shell Scripts - Creating New Command Script File

Mobile
feeds
Welcome Login | Register

How To Create Shell Scripts - Creating New Command Script File
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » Linux Hosting Forums
        » » How To Create Shell Scripts - Creating New Command Script File
How To Create Shell Scripts - Creating New Command Script File
Post Description: how to create shell scripts creating new command script file Linux Hosting
Post Tags:
This Post Has Been Viewed 1496 Times Since Thu Aug 31, 2006 5:33 pm Author unix with 1 replies
Next Post »» Linux UNIX Shell Command To Make Creat File Executable
How To Create Shell Scripts - Creating New Command Script File
Advertise On This Page




One of the most baisc and useful program tools in the shell itself. Its also a ppowerful programming environment

Step 1. Type the following command to create a new file:
     Code:
cat > new_script


Step 2. Type the following lines:

     Code:
echo Your files are
echo today is
datels
Press ENTER to move the cursor to a new line and press CTRL-D. At this point, the file new_script contains a series of shell commands.

Step 3. Examine the file to be cetain it is correct:

     Code:
cat new_script
If there are errors, remove the file new_script and return to step 1 to create it again.

Step 4. Try to run the script by entering its name:

     Code:
new_script
It doesn't run because its not executable.

Step 5. Disply the permission of the file by entering:

     Code:
ls -la new_script
Notice that the file is not executable. You must make it executable.

Step 6. Type the following comand to make new_script executable:

     Code:
chmod +X new_script


Step 7. To see the new permission, enter:

     Code:
ls -l
You now have execute permission, as well as read and write permissions for the file.

Step 8. Execute the new script by typing its name:

     Code:
new_script
All the commands that you tped into the file are executed, and their output is sent to the screen.

Step 9. If you receive an error message such as:

     Code:
Command not found
Type the following:
     Code:
./new_script
This command line tells the shell exactly where to find the shell script, new_script, in your current dirctory knows as "dot."


Leave Your Comments

Share:   Subscribe - Keep Up With This Topic
You can use this HTML code to put it on your website to show your friends this wallpaper. Use this code on your profile like myspace, friendster, Facebook or others. Just Copy and Paste it in your HTML on your websites
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
Fourms BBCODE:
Links Related to : How To Create Shell Scripts - Creating New Command Script File
Add Link:
No Links Have Been Added To This Topic

Comments and replies About How To Create Shell Scripts - Creating New Command Script File
:: 1 :: Reply #77994 Reply By webmasters245 On Tue Oct 28, 2008 9:31 am
webmasters245:
thank you i always wanted to know how to make an executable script