Code Sample |
#!/bin/bash inpoot="${HOME}/.fluxbox/menu" outpoot="${HOME}/.fluxbox/icon_menu" icon_dir="${HOME}/.fluxbox/icons" if [ -f "${outpoot}" ]; then mv -f "${outpoot}" "${outpoot}.bak" fi cat "${inpoot}" | while read line; do full_command=`echo "${line}"|awk -F { '{print $2}'|awk -F } '{print $1}'` case "${full_command}" in [aEx]term*-e*|rxvt*-e*|konsole*-e*|gnome-terminal*-e*) command_name=`echo "${full_command}"|awk -F '-e' '{print $2}'|awk '{print $1}'|awk -F / '{print $NF}'` ;; *) command_name=`echo "${full_command}"|awk '{print $1}'|awk -F / '{print $NF}'` ;; esac icon_name="${icon_dir}/${command_name}.xpm" if [ -f "${icon_name}" ]; then echo "${line} <${icon_name}>" >> ${outpoot} else echo "${line}" >> ${outpoot} fi done |