Hilfe bei Shellscript erbeten
Jan-Benedict Glaw
jbglaw at lug-owl.de
Thu Apr 17 13:17:56 CEST 2008
On Tue, 2008-04-15 19:06:08 +0200, Lukas Kolbe <lukas at knup.de> wrote:
> > auf dem Terminalserver muckt OOo 2.3, wenn
> > eine Grafik aus dem Interent per Drag&Drop in ein
> > Dokument übernommen werden soll (Proxy unbekannt bzw.
> > WPAC/Systemeinstellung kann nicht übernommen werden => OOo hängt).
> >
> > Wie auch immer, man muss ein "killall soffice" absetzen, um danach
> > Openoffice wieder starten zu können. Ich möchte dafür einen Panik-Knopf
> > hinterlegen. Das zugehörige Bashscript stelle ich mir so vor:
> >
> > set num = $( ps aux |grep soffice |wc -l ) - 1
>
> Wenn du das so implementieren willst, hilft
>
> num=$(($(ps aux|grep soffice|wc -l) - 1))
Und weil in 'grep soffice' ein 'soffice' vorkommt, ziehst Du hinterher
wieder eins ab? Was, wenn die shell noch dabei ist, den grep zu
starten? Dann bekommst Du eins zuwenig dabei heraus...
pgrep!
> (ohne Leerzeichen vor und nach '=', in $(( )) steht aun arithmetischer
> Ausdruck, in $( ) wird ein Kommando ausgeführt)
>
>
> > if [ test $num == "0" ] ; then
Was ist das denn?
if [ $num = 0 ]; then
...
fi
"[" _ist_ doch gerade bereits schon 'test'! Und '==' ist akzeptiert,
aber nicht portabel. Die null muß zudem nicht gequoted werden, mit der
kann ja nichts mehr passieren.
MfG, JBG
--
Jan-Benedict Glaw jbglaw at lug-owl.de +49-172-7608481
Signature of: The real problem with C++ for kernel modules is:
the second : the language just sucks.
-- Linus Torvalds
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lug-owl.de/pipermail/linux/attachments/20080417/edf95127/attachment.sig>
More information about the Linux
mailing list