style: Normalize variable expansions to ${var} across the repo
Replace bare $var with ${var} everywhere it was still used, matching
the convention already established in rc.d/prompt and rc.d/history.
Positional parameters ($1, $@, $#) and special variables ($?, $$, $-)
are left as-is, consistent with existing usage in _helpers.bash.
rc.d/broot is auto-generated by the broot binary and will likely be
overwritten with its original formatting on the next broot update.
This commit is contained in:
+5
-5
@@ -1,17 +1,17 @@
|
||||
note() {
|
||||
# if file doesn't exist, create it
|
||||
if [[ ! -f $HOME/.notes ]]; then
|
||||
touch "$HOME"/.notes
|
||||
if [[ ! -f "${HOME}/.notes" ]]; then
|
||||
touch "${HOME}"/.notes
|
||||
fi
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
# no arguments, print file
|
||||
cat "$HOME"/.notes
|
||||
cat "${HOME}"/.notes
|
||||
elif [[ "$1" == "-c" ]]; then
|
||||
# clear file
|
||||
echo "" >"$HOME"/.notes
|
||||
echo "" >"${HOME}"/.notes
|
||||
else
|
||||
# add all arguments to file
|
||||
echo "$@" >>"$HOME"/.notes
|
||||
echo "$@" >>"${HOME}"/.notes
|
||||
fi
|
||||
}
|
||||
|
||||
+13
-13
@@ -1,21 +1,21 @@
|
||||
encpasswd() {
|
||||
local password_clear=$1
|
||||
local password_md5hash=$(openssl passwd -1 "$password_clear")
|
||||
local password_sha1=$(echo -n "$password_clear" | openssl dgst -sha1)
|
||||
echo "Password : $password_clear"
|
||||
echo "MD5HASH : $password_md5hash"
|
||||
echo "SHA1 : $password_sha1"
|
||||
local password_md5hash=$(openssl passwd -1 "${password_clear}")
|
||||
local password_sha1=$(echo -n "${password_clear}" | openssl dgst -sha1)
|
||||
echo "Password : ${password_clear}"
|
||||
echo "MD5HASH : ${password_md5hash}"
|
||||
echo "SHA1 : ${password_sha1}"
|
||||
}
|
||||
|
||||
genpasswd() {
|
||||
local l=$1
|
||||
[ "$l" == "" ] && l=12
|
||||
[ "${l}" == "" ] && l=12
|
||||
local password_clear=$(tr -dc A-Za-z0-9_ </dev/urandom | head -c "${l}" | xargs)
|
||||
local password_md5hash=$(openssl passwd -1 "$password_clear")
|
||||
local password_sha1=$(echo -n "$password_clear" | openssl dgst -sha1)
|
||||
local password_base64=$(echo -n "$password_clear" | base64)
|
||||
echo "Password : $password_clear"
|
||||
echo "Base64 : $password_base64"
|
||||
echo "MD5HASH : $password_md5hash"
|
||||
echo "SHA1 : $password_sha1"
|
||||
local password_md5hash=$(openssl passwd -1 "${password_clear}")
|
||||
local password_sha1=$(echo -n "${password_clear}" | openssl dgst -sha1)
|
||||
local password_base64=$(echo -n "${password_clear}" | base64)
|
||||
echo "Password : ${password_clear}"
|
||||
echo "Base64 : ${password_base64}"
|
||||
echo "MD5HASH : ${password_md5hash}"
|
||||
echo "SHA1 : ${password_sha1}"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
function term_change_title {
|
||||
case $TERM in
|
||||
case ${TERM} in
|
||||
# Change the window title of X terminals
|
||||
xterm* | rxvt* | urxvt* | Eterm)
|
||||
echo -ne "\033]0;${1}\007"
|
||||
|
||||
+8
-8
@@ -1,20 +1,20 @@
|
||||
todo() {
|
||||
if [[ ! -f $HOME/.todo ]]; then
|
||||
touch $HOME/.todo
|
||||
if [[ ! -f "${HOME}/.todo" ]]; then
|
||||
touch "${HOME}/.todo"
|
||||
fi
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
cat $HOME/.todo
|
||||
cat "${HOME}/.todo"
|
||||
elif [[ "$1" == "-l" ]]; then
|
||||
cat -n $HOME/.todo
|
||||
cat -n "${HOME}/.todo"
|
||||
elif [[ "$1" == "-c" ]]; then
|
||||
echo "" > $HOME/.todo
|
||||
echo "" > "${HOME}/.todo"
|
||||
elif [[ "$1" == "-r" ]]; then
|
||||
cat -n $HOME/.todo
|
||||
cat -n "${HOME}/.todo"
|
||||
echo -ne "----------------------------\nType a number to remove: "
|
||||
read NUMBER
|
||||
sed -ie ${NUMBER}d $HOME/.todo
|
||||
sed -ie "${NUMBER}d" "${HOME}/.todo"
|
||||
else
|
||||
echo "$@" >> $HOME/.todo
|
||||
echo "$@" >> "${HOME}/.todo"
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user