LINUX.ORG.RU

История изменений

Исправление Extraterrestrial, (текущая версия) :

А чем dmenu не угодило?

#!/bin/bash

declare -a names # names
declare -a cmds  # commands
declare -i i     # increment
declare -i j     # also increment

while read x; do
  names[i]=`echo $x | cut -f1 -d ':'`
  cmds[i]=`echo $x | cut -f2 -d ':'`
  ((i++))
done

echo "Names array: ${names[*]}"
echo "Commands array: ${cmds[*]}"
echo "Waiting for dmenu..."

name=`echo ${names[*]} | sed 's/ /\n/g' | dmenu -i -l $i`
if [ -z "$name" ]; then
  echo "No command given, exiting..."
  exit 1
fi
echo "Trying to start $name"
for j in `seq 0 $i`; do
  if [ $name = ${names[j]} ]; then
    setsid ${cmds[j]}
    exit 0
  fi
done
$ echo -e "Firefox:firefox\nPidgin:pidgin\nAudacious:audacious -m" | ./dmenu-launcher.sh

Выйдет что-то типа такого.

Исходная версия Extraterrestrial, :

А чем dmenu не угодило?

#!/bin/bash

declare -a names # names
declare -a cmds  # commands
declare -i i     # increment
declare -i j     # also increment

while read x; do
  names[i]=`echo $x | cut -f1 -d ':'`
  cmds[i]=`echo $x | cut -f2 -d ':'`
  ((i++))
done

echo "Names array: ${names[*]}"
echo "Commands array: ${cmds[*]}"
echo "Waiting for dmenu..."

name=`echo ${names[*]} | sed 's/ /\n/g' | dmenu -i -l $i`
if [ -z "$name" ]; then
  echo "No command given, exiting..."
  exit 1
fi
echo "Trying to start $name"
for j in `seq 0 $i`; do
  if [ $name = ${names[j]} ]; then
    setsid ${cmds[j]}
    exit 0
  fi
done
$ echo -e "Firefox:firefox\nPidgin:pidgin\nAudacious:audacious -m" | ./dmenu-launcher.sh