Login PID in sh/bash different


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Login PID in sh/bash different
# 1  
Old 02-22-2014
Login PID in sh/bash different

In bourne shell the PID generated for the command "ps" matches my login id PID in the command "who -Hu" but in bash/linux the PID generated with the same commands are different . Why so?
# 2  
Old 02-22-2014
You are aware that Bourne Shell and BASH are the same, arent you? Smilie
Maybe ps -ue helps to enlighten.

Hope this helps

EDIT:
Test file:
Code:
echo $$
echo $!
echo $PPID

From - Man Page for bash (linux Section 1) - The UNIX and Linux Forums
Code:
       BASHPID
	      Expands to the process ID of the current bash process.  This differs from $$  under
	      certain circumstances, such as subshells that do not require bash to be re-initial-
	      ized.

Code:
PPID   The process ID of the shell's parent.  This variable is readonly.


Last edited by sea; 02-22-2014 at 11:17 PM..
# 3  
Old 02-24-2014
Quote:
Originally Posted by sea
You are aware that Bourne Shell and BASH are the same, arent you? Smilie
You are mistaken.The Bourne shell and the Bourne Again Shell are not the same thing.

Quote:
Originally Posted by asd78in
In bourne shell the PID generated for the command "ps" matches my login id PID in the command "who -Hu" but in bash/linux the PID generated with the same commands are different . Why so?
I have no idea what this is about. I suggest identifying the operating system and shells precisely, and posting the relevant commands and their output.


Regards,
Alister
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Write pid and command name to a txt file while executing a bash script

Hi All, Just have a requirement, I am executing a bash shell script, my requirement is to catch the pid and job name to a txt file in the same directory, is there anyway to do it? please help me out. Regards Rahul ---------- Post updated at 08:42 AM ---------- Previous update was at... (2 Replies)
Discussion started by: rahulkalra9
2 Replies

2. Shell Programming and Scripting

Bash Login tester Script help!

Hello, first of all, I am a pretty experience c++ programmer, but have never really bothered learning bash scripting at all, so I know conceptually things that can be done in c++, but I'm not too sure about bash. I'm trying to learn Bash, and wanted to start out with a practical application. So I... (1 Reply)
Discussion started by: RSPdev
1 Replies

3. Shell Programming and Scripting

BASH ssh login

Ok, there's been a good number of posts about this, but here goes. I want a script to log in to a system via ssh without using keys. This will be used to log in to Cisco IOS devices. I have tried the following, but could not get it to work: SSH login expect shell script to supply username and... (1 Reply)
Discussion started by: mike909
1 Replies

4. Shell Programming and Scripting

What does this do in bash: ${pid:-}

As i understand it, this means if pid is a) unset, or b) set to null then replace with the value on the right of the minus sign--which is null This confuses me because a) I thought if a variable isn't set to anything it's automatically null. If not then what is an uninitiated... (3 Replies)
Discussion started by: mindOnMy$
3 Replies

5. UNIX for Dummies Questions & Answers

Need to get pid of a process and have to store the pid in a variable

Hi, I need to get the pid of a process and have to store the pid in a variable and i want to use this value(pid) of the variable for some process. Please can anyone tell me how to get the pid of a process and store it in a variable. please help me on this. Thanks in advance, Amudha (7 Replies)
Discussion started by: samudha
7 Replies

6. Shell Programming and Scripting

bash script for ssh login-

hi. I need a bash script which can login to an other mashin via SSH and then run some commands and then return the result to my mashine. I dont know where to begin, I think first I will need a ssh connection, dont know how to make it, then , do I need a ftp connection between the 2 mashins to... (5 Replies)
Discussion started by: big_pil
5 Replies

7. UNIX for Dummies Questions & Answers

Session PID & socket connection pid

1. If I use an software application(which connects to the database in the server) in my local pc, how many PID should be registered? Would there be PID for the session and another PID for socket connection? 2. I noticed (through netstat) that when I logged in using the my software application,... (1 Reply)
Discussion started by: pcx26
1 Replies

8. Shell Programming and Scripting

PID in BASH

In a shell script, in need to execute a proccess in background, do some jobs then kill that process. ie, someproc parameter1 & somescript.sh kill pid_of_the_proc_in_the_first_line How can can get the PID of the process I'm invoking in the first line? (1 Reply)
Discussion started by: rayne
1 Replies

9. Solaris

How to get bash to be the login shell?

Is there a way to edit a .profile file that would let a user have bash as their login shell? We tried adding: exec /bin/bash --login to the .profile, but this produced an endless loop and we could not login using that account. Thanks! Aaron (8 Replies)
Discussion started by: amheck
8 Replies

10. Programming

printing ppid,child pid,pid

question: for the below program i just printed the value for pid, child pid and parent pid why does it give me 6 values? i assume ppid is 28086 but can't figure out why there are 5 values printed instead of just two! can someone comment on that! #include<stdio.h> #define DIM 8 int... (3 Replies)
Discussion started by: a25khan
3 Replies
Login or Register to Ask a Question