| Author |
Message |
musher0

Joined: 04 Jan 2009 Posts: 2199 Location: Gatineau (Qc), Canada
|
Posted: 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.
Thanks in advance.
musher0
_________________
"...l'industrie de l'informatique n'aura besoin que de très peu de temps pour ramener l'humanité aux dessins rupestres." (M. Goebbel, Order of the Command Line; [ma trad.])
Last edited by musher0 on Wed 16 Jan 2013, 19:30; edited 1 time in total
|
|
Back to top
|
|
 |
rcrsn51

Joined: 05 Sep 2006 Posts: 7745 Location: Stratford, Ontario
|
Posted: Wed 16 Jan 2013, 19:07 Post subject:
|
|
What is the objective?
How about
| Code: | | ps -e | grep -io "ROX-Filer" |
|
|
Back to top
|
|
 |
musher0

Joined: 04 Jan 2009 Posts: 2199 Location: Gatineau (Qc), Canada
|
Posted: 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
_________________
"...l'industrie de l'informatique n'aura besoin que de très peu de temps pour ramener l'humanité aux dessins rupestres." (M. Goebbel, Order of the Command Line; [ma trad.])
|
|
Back to top
|
|
 |
rcrsn51

Joined: 05 Sep 2006 Posts: 7745 Location: Stratford, Ontario
|
Posted: Wed 16 Jan 2013, 19:28 Post subject:
|
|
| musher0 wrote: | | Only annoyance now is that "en-bas" appears twice. |
|
|
Back to top
|
|
 |
musher0

Joined: 04 Jan 2009 Posts: 2199 Location: Gatineau (Qc), Canada
|
Posted: Wed 16 Jan 2013, 19:30 Post subject:
|
|
Gee, you're quick!
So, efficient line is : | Code: | | ps f | grep -iom 1 "en-bas" |
Many thanks!
musher0
_________________
"...l'industrie de l'informatique n'aura besoin que de très peu de temps pour ramener l'humanité aux dessins rupestres." (M. Goebbel, Order of the Command Line; [ma trad.])
|
|
Back to top
|
|
 |
musher0

Joined: 04 Jan 2009 Posts: 2199 Location: Gatineau (Qc), Canada
|
Posted: 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
_________________
"...l'industrie de l'informatique n'aura besoin que de très peu de temps pour ramener l'humanité aux dessins rupestres." (M. Goebbel, Order of the Command Line; [ma trad.])
|
|
Back to top
|
|
 |
|