You are not logged in.

#1 2013-08-06 10:43:52

axelectrik
Member
Registered: 2012-01-25
Posts: 126

Toggle Open/Close Launcher

I want to do a launcher so when I click it I open the file manager and when I click again it closes
The code right now::

#!/bin/bash
PIDS=`ps cax | grep "dolphin" | grep "tty1"`

if [ -z "$PIDS" ]; then
  echo "Process not running"
  echo $PIDS
  dolphin /files
else
  echo "Process is running"
  echo "$PIDS"
  kilall dolphin
fi

(I added the tty in grep because somehow when I launch this script the echo of $PIDS throws two dolphin running in /dev/pts regardless of if dolphin is running or not)

This is exteremely simple but I can't find how to make it work!!
I'd appreciate any idea
Thank you smile

Offline

#2 2013-08-06 11:41:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,550
Website

Re: Toggle Open/Close Launcher

You might want to check out pgrep


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB