question

hi
tellme how to do myown shell script

With the keyboard? :slight_smile:

As much as I like your answer Deepsoul...

It's simple - to do a script you have a choice of shells or languages - choose one that you are use to using (such as the shell you use normally - do a
echo $SHELL to find out what you are using).

Once you have that, cd to your home directory - vi a new file (such as my-new-script)
$ cd
$ vi my-new-script
Insert the commands in the same order you would run them normally from the command line - only difference - add #!/bin/sh or whatever shell you are using at the top - this lets the system know what you are running these commands under

#!/bin/sh
/bin/cp /dirA/* /dirB/*
exit

Then use chmod as suggested to change the script to executable
A script is putting all the commands you usually have to do into a file to run - it's doing what you would do automatically (via cron if needed). The only thing a script does it make it so you don't have to type those commands every time.

Try this on your system:
$ cd
$ vi hbo
i
#!/bin/sh
date +'%n %D %A %T%n'
exit

Hit the escape key, put in a wq to write-quit from the vi editor
$ chmod 744 hbo
$ ./hbo

01/18/05 Tuesday 19:44:04

$

That's all there is to it -

Your question is so basic, the only good answer is:
Get a basic book on unix - like the SAM's 'UNIX in 21 days'

Learn:

  1. basic command line syntax and some comands
  2. how to edit a file
  3. put some basic command(s) in a file, put execute privilege on the file, run it.

I wonder what Gollum would have replied. :slight_smile: