Révision 683f57f9
Ajouté par Julien Enselme il y a plus de 10 ans
bin/scripts-utils.sh | ||
---|---|---|
12 | 12 |
|
13 | 13 |
ask_password() { |
14 | 14 |
# read -s doesn't work with sh. |
15 |
# usage: pass=`ask_password "password please:"`
|
|
15 |
# usage: pass=$(ask_password "password please:")
|
|
16 | 16 |
echo $1 >&2 |
17 | 17 |
echo -n ">" >&2 |
18 |
stty_avant=`stty -g`
|
|
18 |
stty_avant=$(stty -g)
|
|
19 | 19 |
stty -echo |
20 | 20 |
read password |
21 | 21 |
stty $stty_avant |
... | ... | |
36 | 36 |
fi |
37 | 37 |
|
38 | 38 |
while echo "$site_password" | grep -Fq '/' ; do |
39 |
site_password=`dd if=/dev/random count=1 | uuencode -m - | head -n 2 | tail -n 1 | cut -c-$password_length`
|
|
39 |
site_password=$(dd if=/dev/random count=1 | uuencode -m - | head -n 2 | tail -n 1 | cut -c-$password_length)
|
|
40 | 40 |
done |
41 | 41 |
|
42 | 42 |
echo $site_password |
... | ... | |
63 | 63 |
give_dir() { |
64 | 64 |
# ARG: file |
65 | 65 |
# Return the abosulte directory path of a file or a dir. |
66 |
settings_location=`realpath $1`
|
|
67 |
echo `dirname $settings_location`
|
|
66 |
settings_location=$(realpath $1)
|
|
67 |
echo $(dirname $settings_location)
|
|
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
work_tree_clean() { |
71 |
git_status_output=`git status --porcelain`
|
|
71 |
git_status_output=$(git status --porcelain)
|
|
72 | 72 |
if [ -z "$git_status_output" ] ; then |
73 | 73 |
return 0 |
74 | 74 |
else |
... | ... | |
78 | 78 |
|
79 | 79 |
mail_unclean_work_tree() { |
80 | 80 |
cd $dir_multi_assos |
81 |
git_status_output=`git status`
|
|
81 |
git_status_output=$(git status)
|
|
82 | 82 |
echo "$git_status_output" | mail -s "$1" $email_multi_assos |
83 | 83 |
} |
84 | 84 |
|
85 | 85 |
commit_if_unclean() { |
86 |
if ! `work_tree_clean` ; then
|
|
86 |
if ! work_tree_clean ; then
|
|
87 | 87 |
commit_message="COMMIT OF UNCLEAN STUFF" |
88 | 88 |
commit -a -m "$commit_message" |
89 | 89 |
mail_unclean_work_tree "[git] $commit_message" |
Formats disponibles : Unified diff
Uniformisation: from
cmd
to $(cmd).