GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: quick question
Operating System - HP-UX
1847987
Members
5227
Online
104022
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
03-26-2002 09:32 PM
03-26-2002 09:32 PM
Hi all
I'm trying to create a variable 'pid' from the output of the command
echo $port
1p15
when i do
ps -ef | grep $port, i get the output from the grep command plus my grep
ie
root 880 1 0 Mar 24 ? 0:25 ocd -n***.**.***.*** -f/dev/telne
t/1p15 -b01 -p15 -c/etc/ddfa
root 17786 10571 1 05:29:53 pts/0 0:00
grep 1p15
I want to create a variable $pid using
pid=`ps -ef | grep $port | awk '{ print $2 }'`
echo $pid
880 17253
why do I get the first 2 columns from both lines and not just the first?
How can I get $pid to equal the 2nd column of the 1st line?
TIA
Steve
I'm trying to create a variable 'pid' from the output of the command
echo $port
1p15
when i do
ps -ef | grep $port, i get the output from the grep command plus my grep
ie
root 880 1 0 Mar 24 ? 0:25 ocd -n***.**.***.*** -f/dev/telne
t/1p15 -b01 -p15 -c/etc/ddfa
root 17786 10571 1 05:29:53 pts/0 0:00
grep 1p15
I want to create a variable $pid using
pid=`ps -ef | grep $port | awk '{ print $2 }'`
echo $pid
880 17253
why do I get the first 2 columns from both lines and not just the first?
How can I get $pid to equal the 2nd column of the 1st line?
TIA
Steve
take your time and think things through
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 09:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 09:58 PM
03-26-2002 09:58 PM
Re: quick question
logical
thanks
Steve
thanks
Steve
take your time and think things through
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP