how to run shell script automatically

hi ,
i m trying to run bash scrip automaticially but i dont know how i can do this an anybody tell me how i can autorun shell script when i logon .
thanks

depends on the shell you are using... have a look at the manpage of you login-shell and insert your script in the mentioned startup config file... should be something like ".profile".

i m using bash shell.

i have ctreated a script myscript.sh and copied it in /etc/init.d/myscript and then i created a link in /etc/rc3.d/mylink this links points to myscript but it does't work . can u write PATH of config file..

thanks

has to be /etc/rc3.d/SXXmyscript (XX = number). but with that the script will be executet on strartup of your machine, not at login!

myscript.sh file path is /etc/init.d/myscript.sh

and then created a link , that has path /etc/rc3.d/S10link
but its still not working , is there any other way to autorun shell script when machine startup.

this is THE way to start scripts at startup... if you need the script startet at a special time during startup this is the only and the right way to do it!
have you rebootet the machine after the changes? is the script and the link executable? is the script working if you start it manually?

Also check the default runlevel in /etc/inittab. It should be:

id:3:initdefault:

Regards

The description sounds IMHO like a Debian/Ubuntu system, in which case messing with runlevels in the inittab is not usually expected or necessary.

Debian startup scripts should nominally be Dash-compatible; if your script doesn't contain any troublesome bashisms, try change the interpreter to /bin/sh instead of /bin/bash

Do you get any error messages or anything when you run the script? What about if you bring up the system in single-user mode, can you run the script from the prompt without errors then?

Thank u DukeNuke .......
I have tried this and now its working ...

Thank u So much ..
Regards
Tahir

Thank u all of u , yes now its working

best regards