- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: xterm + script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2002 03:17 AM
06-08-2002 03:17 AM
xterm + script
1. Can any one tell me why this error "xterm: can't execvp /abc.sh" is appearing on the xterm window when I ran this command on the prompt "$ xterm -e abc.sh"?.
2. The abc.sh script exits with value "5" but after execution of this abc.sh with xterm its returning only 0 when I did echo $?. How do I get the return value 5 to the calling shell?
Thanks
Vasu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2002 08:15 AM
06-08-2002 08:15 AM
Re: xterm + script
Try this:
# exec xterm -e "abc.sh 2\> /tmp/abc.err"
# ERRORCODE=`cat /tmp/abc.err`
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2002 09:31 PM
06-09-2002 09:31 PM
Re: xterm + script
I have tried your commands, but still I am getting the same error "xterm: can't execvp /abc.sh 2\>/dev/null".
Thanks
Vasu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2002 09:43 PM
06-09-2002 09:43 PM
Re: xterm + script
#!/bin/sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2002 10:01 PM
06-09-2002 10:01 PM
Re: xterm + script
Make sure that your script has executable permissions i.e.
bash-2.05a$ chmod +x ./abc.sh
You can fix the return code issue by using a wrapper script i.e. startabc.sh:
bash-2.05a$ cat ./abc.sh
echo this is a test
adfasdf
bash-2.05a$ ./abc.sh
this is a test
./abc.sh: adfasdf: command not found
bash-2.05a$ echo $?
127
bash-2.05a$ rm /tmp/abc.err
bash-2.05a$ cat ./startabc.sh
./abc.sh
echo "$?" > /tmp/abc.err
bash-2.05a$ xterm -e ./startabc.sh
bash-2.05a$ cat /tmp/abc.err
127
Make sure that ./abc.sh and ./startabc.sh has executable permissions.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2002 10:41 PM
06-09-2002 10:41 PM
Re: xterm + script
My script looks like this
startabc.sh
--------------
xterm -e ./abc.sh
echo $?
abc.sh
-------
echo "hello"
exit 5
When I ran startabc.sh it always return 0 & in the xterm session sometimes the error is coming up "xterm: can't execvp /abc.sh"?.
Thanks
Vasu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2002 10:54 PM
06-09-2002 10:54 PM
Re: xterm + script
> xterm -e ./abc.sh
> echo $?
xterm spawns off a separate shell that does not return the exit code (return code) to the parent shell that spawned off xterm.
Thus, to workaround this limitation, you have to echo the "$?" to a file and read from that file in your startabc.sh script:
./startabc.sh:
=============
./abc.sh
echo "$?" > /tmp/abc.err
Then you run this:
# xterm -e ./startabc.sh
# cat /tmp/abc.err # this displays the return code
If you want, you can put these two lines in another wrapper so that the return code is automatically displayed.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 03:15 AM
06-10-2002 03:15 AM
Re: xterm + script
try adding the pathname to xterm and abc.sh
Steve Steel