Plutots foireux certains scripts, <> par exemple se fait bcp plus simplement (et correctement) ainsi:
-------------------- CUT HERE -------------------------
#!/bin/sh
WHOAMI=`whoami`
if [ `uname` = "Linux" ]; then
LIST_PID=`ps -U $WHOAMI | awk '1ドル !~ /PID/ && 3ドル !~ /00:00:0/ { printf(1ドル" " }'`
else
# a verifier selon l'unix desir
LIST_PID=`ps -U $WHOAMI | awk '1ドル !~ /PID/ && 3ドル !~ /00/ { printf(1ドル" " }'`
fi
kill -9 $LIST_PID
-------------------- CUT HERE -------------------------
<> peut se remplacer :) avantageusement par un <<perl -pie 's//g' /path/to/file>>
<> peut etre automatiser par emacs en rajoutant:
-------------------- CUT HERE -------------------------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Shell scripts
;; make #! scripts runable
(add-hook 'after-save-hook 'make-buffer-file-executable-if-script-p)
(defun make-buffer-file-executable-if-script-p ()
"Make file executable according to umask if not already executable.
If file already has any execute bits set at all, do not change existing
file modes."
(and (save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(save-match-data
(looking-at "^#!"))))
(let* ((current-mode (file-modes (buffer-file-name)))
(add-mode (logand ?111円 (default-file-modes))))
(or (/= (logand ?111円 current-mode) 0)
(zerop add-mode)
(set-file-modes (buffer-file-name)
(logior current-mode add-mode))))))
-------------------- CUT HERE -------------------------
qque part dans un .emacs
enfin bon. Et puis les commentaires c'est quand meme utile hein
# Re: Site intéressant
Posté par -=[ silmaril ]=- (site web personnel) . En réponse au journal Site intéressant. Évalué à 1.
-------------------- CUT HERE -------------------------
#!/bin/sh
WHOAMI=`whoami`
if [ `uname` = "Linux" ]; then
LIST_PID=`ps -U $WHOAMI | awk '1ドル !~ /PID/ && 3ドル !~ /00:00:0/ { printf(1ドル" " }'`
else
# a verifier selon l'unix desir
LIST_PID=`ps -U $WHOAMI | awk '1ドル !~ /PID/ && 3ドル !~ /00/ { printf(1ドル" " }'`
fi
kill -9 $LIST_PID
-------------------- CUT HERE -------------------------
<> peut se remplacer :) avantageusement par un <<perl -pie 's//g' /path/to/file>>
<> peut etre automatiser par emacs en rajoutant:
-------------------- CUT HERE -------------------------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Shell scripts
;; make #! scripts runable
(add-hook 'after-save-hook 'make-buffer-file-executable-if-script-p)
(defun make-buffer-file-executable-if-script-p ()
"Make file executable according to umask if not already executable.
If file already has any execute bits set at all, do not change existing
file modes."
(and (save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(save-match-data
(looking-at "^#!"))))
(let* ((current-mode (file-modes (buffer-file-name)))
(add-mode (logand ?111円 (default-file-modes))))
(or (/= (logand ?111円 current-mode) 0)
(zerop add-mode)
(set-file-modes (buffer-file-name)
(logior current-mode add-mode))))))
-------------------- CUT HERE -------------------------
qque part dans un .emacs
enfin bon. Et puis les commentaires c'est quand meme utile hein