Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 19 Sep 2014, 10:02
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Can this one-liner be made more compact? [SOLVED]
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
musher0


Joined: 04 Jan 2009
Posts: 4235
Location: Gatineau (Qc), Canada

PostPosted: Wed 16 Jan 2013, 18:58    Post subject:  Can this one-liner be made more compact? [SOLVED]
Subject description: Thanks in advance.
 

Hello, all.

Can this one-liner be made more compact?

Code:
ps -e > ps.txt && grep -io "ROX-Filer" ps.txt && rm -f ps.txt


If so, I can't see it just now. Crying or Very sad

Thanks in advance.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)

Last edited by musher0 on Wed 16 Jan 2013, 19:30; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
rcrsn51


Joined: 05 Sep 2006
Posts: 9114
Location: Stratford, Ontario

PostPosted: Wed 16 Jan 2013, 19:07    Post subject:  

What is the objective?

How about
Code:
ps -e | grep -io "ROX-Filer"
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4235
Location: Gatineau (Qc), Canada

PostPosted: Wed 16 Jan 2013, 19:25    Post subject:  

Hi, rcrsn51.

Thanks. I'm trying to find the condition to launch or not a ROX panel. If the name of the panel can be listed with ps, I will do away with the dummy file I am currently using.

With the help of your idea, I suppose my line should now be this:
Code:
ps f | grep -io "en-bas"

    ("en-bas" being the very bland name of my ROX panel at the bottom of my screen and
    "ps f" rather than "ps -e", because "f" displays a full line with all the parameters used by ROX-filer -- so we can discover if a ROX panel is active or not)

Only annoyance now is that "en-bas" appears twice. (hehe)

BFN.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
rcrsn51


Joined: 05 Sep 2006
Posts: 9114
Location: Stratford, Ontario

PostPosted: Wed 16 Jan 2013, 19:28    Post subject:  

musher0 wrote:
Only annoyance now is that "en-bas" appears twice.

Code:
 grep -m 1
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4235
Location: Gatineau (Qc), Canada

PostPosted: Wed 16 Jan 2013, 19:30    Post subject:  

Gee, you're quick! Smile

So, efficient line is :
Code:
ps f | grep -iom 1 "en-bas"


Many thanks! Smile

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 4235
Location: Gatineau (Qc), Canada

PostPosted: Mon 21 Jan 2013, 19:17    Post subject:  

Hello again.

Perhaps I marked [SOLVED] a little soon.
The ps command does not diagnose ROX-Filer fully.
The telling file is /root/.config/rox.sourceforge.net/ROX-Filer/panels.
(Thanks to "some1" for reminding me.)
So we use that file instead. The following works well:

Code:
#!/bin/sh
# /root/my-applications/bin/barre-bas.sh
# Cacher ou afficher une barre ROX en bas de l'écran.
# Hide or display a ROX panel at the bottom of the screen.
# musher0, 17 janv. 2013.
####
cd /root/.config/rox.sourceforge.net/ROX-Filer
 [ "`grep -iom 1 \"en-bas\" panels`" == "en-bas" ] && rox -b= || rox -b=en-bas &

# (Pour la commodité de la chose, on peut mettre un icone servant de commutateur sur l'écran.)
# (For ease of use, we can put a switch icon on the screen.)


TWYL

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0521s ][ Queries: 12 (0.0059s) ][ GZIP on ]