Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    If you've used Windows you probably know about batch (.bat) files. They are text files that contain a series of commands executed by the command interpreter. For example this batch file will display the contents of autoexec.bat after first clearing the screen:
    Code:
    cls
    type c:\autoexec.bat
    Here's how you can write the equivalent of a batch file on Unix, which is what most hosts run. This script dumps the database "mydb" to the file "dump.sql":
    Code:
    #!
    mysqldump --opt -uusername -ppassword mydb > dump.sql
    Then instead of remembering the whole command you can just execute the script.

    So do to everything:
    1. SSH/Telnet into your host
    2. Switch to your home directory (cd ~/) if you're not already there
    3. Type pico scriptfilename
    4. Type the following:
    Code:
    #!
    command you want to run
    next command you want to run
    .
    .
    .
    5. Press Ctrl-X and Enter twice to save the file and exit.
    6. Type chmod +x scriptfilename

    Now whenever you want to run the script, just switch to your home directory and type ./scriptfilename! You don't even have to switch to your home directory; you can also type ~/scriptfilename.

    A simple tutorial that I bet a few people knew about before, but useful nonetheless.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:50 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com