HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
Showing results for 
Search instead for 
Did you mean: 

C Compiler program (memdetail)

Go to solution
Trusted Contributor

C Compiler program (memdetail)


i have read one thread with the following notes :-

And here's a little program I use called memdetail. It is a c program - compiles with the built in HP-UX compiler.

cc memdetail1.c

mv a.out /usr/local/bin/memdetail

Output like:

# memdetail
Memory Stat total used avail %used
physical 40958.0 28445.2 12512.8 69%
active virtual 30213.0 8304.0 21909.1 27%
active real 19827.2 6694.1 13133.0 34%
memory swap 40958.0 15385.0 25573.0 38%
device swap 83964.0 31218.8 52745.2 37%



I downloaded this memdetail program and made a file named memdetail.sh in my server. But when i execute this program with

# sh memdetail.sh

it gives a hell of errors. Please tell me how can i execute this C program in my HP-UX box. I am attaching that program with it for your reference.

Steven E. Protter
Exalted Contributor

Re: C Compiler program (memdetail)


Need to see the errors.

perhaps use tusc and record process detail as well (equivalent of strace in Linux)

Steven E Protter
Owner of ISN Corporation
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Trusted Contributor

Re: C Compiler program (memdetail)

Below are the errors :-

$ sh memdetail.sh
memdetail.sh: /1: Execute permission denied.
memdetail.sh[2]: DiSK_OUT: Execute permission denied.
memdetail.sh[3]: DiSK_OUT: Execute permission denied.
memdetail.sh[4]: 11.00: not found.
memdetail.sh[5]: Syntax error at line 6 : `newline or ;' is not expected.
$ memdetail.sh[4]: DiSK_OUT: Execute permission denied.

after this, i interrupted it with ctrl+C. But i think, where in C, we use # to include functions, it may be taken as a comment in shell execution.

James R. Ferguson
Acclaimed Contributor

Re: C Compiler program (memdetail)

Hi Ranju:

Did you compile like this(?):

# cc ./memdetail.c -o ./memdetail

...where the C program is named 'memdetail.c'

...and then at a shell prompt do:

# ./memdetail


Trusted Contributor

Re: C Compiler program (memdetail)

Thanks James,

it worked out with cc. Full points to you.

thanks everyone.
Trusted Contributor

Re: C Compiler program (memdetail)

closing this thread.