.profile - autoexecute

Hi all
i have a requirement to auto execute a script as soon as the root user logs in.

  1. My script CF.sh is placed under /home of my QNX pc
  2. The CF.sh will just clear the screen and asks for the user input
    (a) to mount and read the CF
    (b) to exit the menu
  3. Following is the script i have written in .profile to auto execute my CF.sh script.

#Profile
cd /home
pterm &
./CF.sh

Let me know am i missing something… or is there any other way to do it

Thanks in Advance
JK

JK,

It seems fine. However, I wouldn’t put it in the /home directory. Why not just put the script in the /usr/bin directory so that you can call it directly without any path (ie CF.sh)

Is there a problem with the script?

Tim

Thanks fro the reply

The actual challenge is that we have to figure out a way to execute a set of commands in a New terminal after executing the “pterm &” command
for Example:
#Script Start
pertm &
ls -l
#Script End

If the above script is executed we would get a new terminal opened with the “ls” got executed in the Old terminal.
Instead is there a way to execute this command in the New terminal that was recently spawned.

Thanks again
Regds
JK

JK,

I use this:

pterm ./myCommands &

So put all the commands you want to execute in your pterm into another script called myCommands. Then call that script from your script:

#Script myCommands
ls -l
#Script End

#Script Start
pertm ./myCommands &
#Script End

There are probably other ways to do it but this seems to be a simple way to do what you want. Assuming of course you don’t need to pass any results of commands executed back to your original script.

Tim