- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: variable integer not passed
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
12-16-2005 08:43 AM
12-16-2005 08:43 AM
variable integer not passed
#!/bin/ksh
integer Line=0
Lines=$(cat /root/.sh_history | wc | awk '{print $1}' )
print "total lines to read in History file is $Lines"
history -${Lines} > ${Work_file}
Output is....
total lines to read in History file is 268
./Audit_root_Daily[90]: 1^Ill: syntax error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 08:55 AM
12-16-2005 08:55 AM
Re: variable integer not passed
The command looks ok otherwise.
Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 09:00 AM
12-16-2005 09:00 AM
Re: variable integer not passed
Work_file=/usr/local/work/${Prgrm_name}.wrk
I clipped this from a 300 line routine that is failing me. Originally it worked interactively but would never work batch.
The error has something unique to the variable Lines not passing a value to the history command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 09:30 AM
12-16-2005 09:30 AM
Re: variable integer not passed
Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 09:53 AM
12-16-2005 09:53 AM
Re: variable integer not passed
Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 09:57 AM
12-16-2005 09:57 AM
Re: variable integer not passed
1^Ill: syntax error
but if I hard code a number into the script that I know will work, all is fine. I would like to use a huge number to cover the entire file, but history doesn't like that at all when run batch. That's why I count the lines in the history file first, then use that variable to list out the file. For instance, if I hard code 268 into the script, all will be fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 10:28 AM
12-16-2005 10:28 AM
Re: variable integer not passed
Have you tried this yourself? and does it work for you? I have a feeling passing an option as a variable is not possible through scripting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 10:38 AM
12-16-2005 10:38 AM
Re: variable integer not passed
The shell history file contains more than simple ASCII characters.
As an alternative to 'cat|wc|awk' try:
# lines=$(awk 'END {print i};{i=1;while (getline) i++}' /root/.sh_history)
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 10:43 AM
12-16-2005 10:43 AM
Re: variable integer not passed
But, if I change it to a posix shell script, it works. Change first line to #!/bin/sh
Not sure yet why sh likes it but ksh doesn't, ... still tinkering.
- John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 10:52 AM
12-16-2005 10:52 AM
Re: variable integer not passed
- John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2005 11:21 AM
12-16-2005 11:21 AM
Re: variable integer not passed
I believe you should be looking around line ninety in the script.
./Audit_root_Daily[90]: 1^Ill: syntax error
Also, as you have found, large numbers are not acceptable.
I tested up to 127 as a value for Lines without issue.
Regards,
dl