- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell 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
Discussions
Discussions
Forums
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
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
тАО08-29-2003 02:32 AM
тАО08-29-2003 02:32 AM
root>cat test_num.sh
for numero_sel in 01 02 03 04 05 06 07 08 09 10 11 12
do
((numero_sel=$numero_sel+1))
echo $numero_sel
done
the original script take value from the current month(mese=`date +%m`) and add 0 to make 01,02,... in numeric.
the script gave me an error when months = 08 or 09 with other months it works.
Is this an error of the shell???
I' tried it on HP-UX 11.00 and 11.11 with the same result.
Have someone any idea??
Thanks Antonio
root>sh -x test_num.sh
+ (( numero_sel=01+1 ))
+ echo 2
2
+ (( numero_sel=02+1 ))
+ echo 3
3
+ (( numero_sel=03+1 ))
+ echo 4
4
+ (( numero_sel=04+1 ))
+ echo 5
5
+ (( numero_sel=05+1 ))
+ echo 6
6
+ (( numero_sel=06+1 ))
+ echo 7
7
+ (( numero_sel=07+1 ))
+ echo 8
8
+ (( numero_sel=08+1 ))
test_num.sh[3]: 08+1: The specified number is not valid for this command.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2003 02:40 AM
тАО08-29-2003 02:40 AM
Re: shell error?
eg:
numero_sel=`expr $numero_sel + 1`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2003 02:51 AM
тАО08-29-2003 02:51 AM
Re: shell error?
if [ $numero_sel = 08 ] ; then
numero_sel=9
else
if [ $numero_sel = 09 ] ; then
numero_sel=10
else
((numero_sel=$numero_sel+1))
fi
fi
my question is why the error with 08 an 09?
there is a patch?
my script is invalid?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2003 02:55 AM
тАО08-29-2003 02:55 AM
SolutionThis is a recent change in the shell's behavior to conform with ISOC standards, namely that numbers starting with '0' should be recognized as octal and numbers starting with '0x' or 'OX' should be should be recognized as hexadecimal.
Drop the leading '0' from your numbers and all will work as intended.
See, for instance, PHCO_28831 for 11.0 or PHCO_27345 for 11.11 for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2003 02:57 AM
тАО08-29-2003 02:57 AM
Re: shell error?
Strange, I tested on HP-UX 11 and I can't reproduce your problem. Maybe a patch problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2003 03:12 AM
тАО08-29-2003 03:12 AM
Re: shell error?
Bill Hassell, sysadmin