LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   ps | grep command combination - Strange Output. Why Environment Variables Listed ? (http://www.linuxquestions.org/questions/linux-general-1/ps-%7C-grep-command-combination-strange-output-why-environment-variables-listed-800512/)

nkataria 04-07-2010 02:21 AM

ps | grep command combination - Strange Output. Why Environment Variables Listed ?
 
Can Any body explain the following command output ?

###############################################
[root@abcd-pc root]# ps -ef | grep anacron
root 20282 3641 0 12:07 pts/3 00:00:00 grep anacron HOSTNAME=abcd-pc SHELL=/bin/bash TERM=xterm HISTSIZE=1000 QTDIR=/usr/lib/qt-3.3 OLDPWD=/etc/cron.daily USER=root LD_LIBRARY_PATH=:/usr/local/Trolltech/Qt-4.3.0/lib LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi= 01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00 ;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz =00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;3 5:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35: KDEDIR=/usr USERNAME=root MAIL=/var/spool/mail/root PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/usr/local/Trolltech/Qt-4.3.0/bin:. INPUTRC=/etc/inputrc PWD=/root LANG=en_US.UTF-8 SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass SHLVL=1 HOME=/root BASH_ENV=/root/.bashrc LOGNAME=root LESSOPEN=|/usr/bin/lesspipe.sh %s DISPLAY=:0.0 G_BROKEN_FILENAMES=1 XAUTHORITY=/root/.xauthUhz1Eu _=/bin/grep /bin/grep
#################################################

Actually I was checking whether anacron is running presently on my system. Seen this strange output. Again executed the same command, but only the first line upto "anacron" appears.

I can understand that the output upto "grep anacron" is coming in the first line, but why all the environment variables were displayed during first execution?

devnull10 04-07-2010 03:50 AM

Perhaps you have buggered something up in your .bashrc file with aliases etc (ie, not terminating with a '), which is causing the additional output??


All times are GMT -5. The time now is 03:06 PM.