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 Sat 25 Oct 2014, 04:01
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 Posts_count  
Author Message
musher0


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

PostPosted: Wed 16 Jan 2013, 18:58    Post_subject:  Can this one-liner be made more compact? [SOLVED]
Sub_title: 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)

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
rcrsn51


Joined: 05 Sep 2006
Posts: 9203
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: 4257
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_website 
rcrsn51


Joined: 05 Sep 2006
Posts: 9203
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: 4257
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_website 
musher0


Joined: 04 Jan 2009
Posts: 4257
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_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0504s ][ Queries: 11 (0.0043s) ][ GZIP on ]