Perso j'utilise plus "sudo su -", parceque ça m'enerve qu'il me mette dans /root, ce genre de trucs. J'utilise ça du coup, qui me sert à la fois de "sudo" tout court (si je passe des arguments) et de "sudo su -" (sans argument) pour avoir un shell mais au bon endroit :
root() {
local command="/bin/bash -l"
if [ -n "${*}" ]; then
command="${command} -c '{ cd \"${PWD}\" ;"
# That mess is for quoting the command's arguments
# (think of `root cat filename\ with\ spaces`)
while [ -n "${*}" ] ; do
command="${command} \"${1}\""
shift
done
command="${command} ; }'"
fi
sudo su -c "${command}"
}
Bon ouais c'est un peu bourrin, faudrait peut-être simplement que je fasse "man sudo" un jour, qui sait...
[^] # Re: pwgen
Posté par tgl . En réponse au journal Une idée fausse et des idées persos sur les mots de passe. Évalué à 3.
root() { local command="/bin/bash -l" if [ -n "${*}" ]; then command="${command} -c '{ cd \"${PWD}\" ;" # That mess is for quoting the command's arguments # (think of `root cat filename\ with\ spaces`) while [ -n "${*}" ] ; do command="${command} \"${1}\"" shift done command="${command} ; }'" fi sudo su -c "${command}" }Bon ouais c'est un peu bourrin, faudrait peut-être simplement que je fasse "man sudo" un jour, qui sait...