- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ps -o within script fails
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-17-2003 02:18 AM
12-17-2003 02:18 AM
I want to use the ps command within a script to control processes and I want to build it with variables:
PS="/usr/bin/ps"
PS_OPT="-efl"
$PS ${PS_OPT} > temp_file
It works fine when PS_OPT="-efl" but it does not work when PS_OPT="-e -o args"; I get the following error message:
/usr/bin/ps: illegal option --
/usr/bin/ps: illegal option -- -
/usr/bin/ps: is not a valid field name
To be able using the -o option I set UNXI95 to 1 and export it just before executing the ps command.
ps -e -o args works fine when executed directly on command line.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 02:24 AM
12-17-2003 02:24 AM
Re: ps -o within script fails
See if this makes any difference
UNIX95= $PS ${PS_OPT}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 02:25 AM
12-17-2003 02:25 AM
Re: ps -o within script fails
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 02:26 AM
12-17-2003 02:26 AM
Re: ps -o within script fails
I confirm that this 3 lines script works perfectly :
PS="/usr/bin/ps"
PS_OPT="-e -o args"
UNIX95= $PS ${PS_OPT}
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 02:29 AM
12-17-2003 02:29 AM
Re: ps -o within script fails
PS="/usr/bin/ps"
PS_OPT="-e -o args"
UNIX95= $PS $PS_OPT
Use UNIX95 with the command instead of exporting it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 02:52 AM
12-17-2003 02:52 AM
Re: ps -o within script fails
As mentioned, always put UNIX95= in front of the ps command. NOTE: It may look strange but it wor4ks just fine. You don't have to assign a value, just the = sign is fine.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 03:24 AM
12-17-2003 03:24 AM
Re: ps -o within script fails
Here is my script attached. Have I made some mistakes I am unable to see?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 03:31 AM
12-17-2003 03:31 AM
Re: ps -o within script fails
sh -x
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 03:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 03:39 AM
12-17-2003 03:39 AM
Re: ps -o within script fails
in your case, to avoid modifying IFS you could also use :
cat $FICHIER_PARAM | tr -d '|' ' ' | while read ...
do
xxx
done
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 11:10 PM
12-17-2003 11:10 PM
Re: ps -o within script fails
Thanks.