- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script error
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
10-21-2003 05:33 AM
10-21-2003 05:33 AM
#!/bin/ksh
ls -l
if [ `echo $?` == 0 ]
then
echo "success"
else
echo "Failed"
fi
But its giving an error,
==: 0403-012 A test command parameter is not valid.
any ideas ..why?
thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2003 05:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2003 05:47 AM
10-21-2003 05:47 AM
Re: script error
ls -l
a=`echo $?` ---or--- a=$(echo $?)
if [ "$a" -eq 0 ]
then
echo scucces
else
echo faild
fi
succes
idriz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2003 05:53 AM
10-21-2003 05:53 AM
Re: script error
first of all the tic '..' are obsolete too. use $(..) instead.
$? is the return code of the last command. I would guess that your expecting a 0 for success. So, what your doing is running the command echo 0, take it's return code (which should be 0 as long as you can write to stdout), and then test if it is the value 0.
so what your actually testing is if echo $? was successfull and not the ls.
probably what your wanting to do is
if [[ "$?" = "0" ]] ;then
#success
.
.
or
if (( $? = 0 )) ;then
#success
.
.
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2003 05:58 AM
10-21-2003 05:58 AM
Re: script error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2003 05:59 AM
10-21-2003 05:59 AM