- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: csh syntax to keep a value (variable)
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
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
09-03-2008 08:21 AM
09-03-2008 08:21 AM
how can i fix the following syntax using csh?
user15> num_proc=`ps -fea | grep spadm | grep "/usr/sap/SP1" | grep -v grep | wc -l`
num_proc=26: Command not found.
i need to get a number and the command is not being understood
how do i have to use the syntax for chs ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 08:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 08:44 AM
09-03-2008 08:44 AM
Re: csh syntax to keep a value (variable)
I don't do much c-shell but here is a more modern format that works in posix and korn shell
num_proc=$(ps -fea | grep spadm | grep "/usr/sap/SP1" | grep -v grep | wc -l)
Try that. Test your command though you are possibly getting no results.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 09:28 AM
09-03-2008 09:28 AM
Re: csh syntax to keep a value (variable)
# set num_proc=`ps -fea | grep spadm | grep "/usr/sap/SP1" | grep -v grep | wc -l`
# echo $num_proc
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 09:32 AM
09-03-2008 09:32 AM
Re: csh syntax to keep a value (variable)
set num_proc=`ps -fea | grep spadm | grep "/usr/sap/SP1" | grep -v grep | wc -l`
you might also need "setenv", I don't recall. "man csh" will tell you more.....
unless this is minor maintenance to an existing script, consider using something POSIX-compliant for portability sake
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 09:42 AM
09-03-2008 09:42 AM
Re: csh syntax to keep a value (variable)
I can't resist adding that the use of the *C*rummy C-shell will cause great gnashing of your teeth and others. In the HP-UX world, the POSIX shell ('/usr/bin/sh' or '/sbin/sh' for the root user)' is the standard. You should read this classic:
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
Regards!
...JRF...