Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Shell script: can't execvp

  • 10-04-2006 12:56pm
    #1
    Registered Users, Registered Users 2 Posts: 916 ✭✭✭


    I'm running a shell script which boils down to this:

    #!/bin/sh -f

    ...

    xterm -e $com &


    where $com is the executable I want to run.

    The xterm window opens with the error:

    xterm: can't execvp $com

    I can run the command

    xterm -e $com &

    from the CDE terminal window and it works, so why not from the script?

    Web searchs indicate it's something to do with permissions, but I have full access permission set on $com. Anybody got any ideas. Any help appreciated.


Comments

  • Registered Users, Registered Users 2 Posts: 354 ✭✭AndrewMc


    Does it actually say "can't execvp $com" or have you replaced the end of the output with the string $com in your post? What does $com contain and how is it assigned?


  • Closed Accounts Posts: 96 ✭✭krinDar


    AndrewMc wrote:
    Does it actually say "can't execvp $com" or have you replaced the end of the output with the string $com in your post? What does $com contain and how is it assigned?

    In other words - include all the script. You may be leaving out something
    that is causing the problem. If there is something sensitive in the script
    then reduce it to something that demonstrates the problem without
    the sensitive info - in the process of doing that you might find your
    problem.

    Also, include the OS and the version.


  • Registered Users, Registered Users 2 Posts: 916 ✭✭✭MicraBoy


    Sorry my over simplification didn't really over simplify anything. See below for the full script. In the last line I have tried both

    xterm -l -lf $logfile -n "SIM" $geom -title " [$USER @ $HOST ] logfile is [$logfile] " -e $com &

    and the much simpler

    xterm -e $com &

    I really think this is some environmental problem rather than anything in the script. I'm pretty sure I used it before without this difficulty.

    I am using Solaris SunOS 5.8, Desktop CDE1.4.8, X11 V6.4.1
    Does it actually say "can't execvp $com" or have you replaced the end of the output with the string $com in your post? What does $com contain and how is it assigned?

    No it says xterm: can't execvp runSim
    #!/bin/sh -f

    THISUSER=`echo $USER`
    HDIR=`echo $HOME`
    TLOGDIR=`echo $LOGDIR`

    if [ "$TLOGDIR" = "" ]
    then
    echo "log directory must be specified , source setup.env ";
    exit 1;
    fi

    geom=" -geometry 140x15-0-11 -bg blue ";
    logfile="$TLOGDIR/LOG_TEST.txt";
    rm -fr $logfile;

    cd /client_local/basictest
    pwd
    com="./runSim"
    xterm -l -lf $logfile -n "SIM" $geom -title " [$USER @ $HOST ] logfile is [$logfile] " -e $com &


  • Closed Accounts Posts: 294 ✭✭eggshapedfred


    maybe specify the full path to runSim instead of com = ./runSim, i.e. com=/path/to/runSim


  • Closed Accounts Posts: 96 ✭✭krinDar


    maybe specify the full path to runSim instead of com = ./runSim, i.e. com=/path/to/runSim


    Another thing that might help is to specify '-x' at the start of the script,
    this will print out the commands and their arguments as they are being
    executed. i.e

    #!/bin/sh -f -x


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 916 ✭✭✭MicraBoy


    Oh good God I'm a dope. Sorted it guys. A simple path issue. Sometimes ya just can't see the wood for the trees.

    Thanks for your help folks!


Advertisement