Using ubuntu10.04 these days, multiple instances of the same program will always be opened, such as Firefox/chromium, and so on, so I wrote the following script to enable the function of only one instance:
#! /Bin/sh
# Name: One
# Auther: maxupeng
# Date: 2011-07-02
If ["$ #"-lt 2]; then
Echo "Usage: One <process name> <program name> [<program parameters>]"
Exit-1
Fi
Process = $1;
Program = $2;
Shift;
Shift;
Params = $ *;
N = 'ps-A | grep $ process | WC-l ';
If ["$ N"-EQ 0]; then
$ Program $ Params;
Fi
The script is named one, run chmod U + x one to add executable permissions, and then put sudo MV one/usr/bin to the bin directory, so that the system can find our script.
Now, change the shortcut command to one chromium-Browse/usr/bin/chromium-browser % u.
Chomium-browse is the name of the chromium process at run time, so that if the chromium process already exists every time you click the chromium shortcut, the new chromium will not be started again.