some fixes

This commit is contained in:
Qrakhen 2026-04-02 02:15:23 +02:00
parent b93f250486
commit e52b35a14e
3 changed files with 11 additions and 5 deletions

6
install.sh Normal file → Executable file
View File

@ -22,12 +22,13 @@ if [[ $REPLY == 'y' ]]; then
mkdir -p "$dir/hooks"
cp -r ./library/* $dir
cp -r ./library/hooks/* $dir/hooks/
chmod 744 -R $dir/
echo "Backing up old .bashrc..."
i=0
while [[ -f ~/.bashrc.bak.$i ]]
do
i=$i + 1
i=$((i + 1))
done;
mv ~/.bashrc ~/.bashrc.bak.$i
@ -37,7 +38,8 @@ if [[ $REPLY == 'y' ]]; then
echo "# Installed on $(date -u +'%02d.%02m.%Y %02H:%02M:%02S')" >> ~/.bashrc
echo "" >> ~/.bashrc
echo "source $QASH_LIBRARY_DIR/load.sh" >> ~/.bashrc
printf "\e[35mQash $QASH_VERSION successfully installed!\e[0m"
printf "\e[35mQash $QASH_VERSION successfully installed!\e[0m\n"
echo "USE source ~/.bashrc TO LOAD QASH IF YOU HAVE EXECUTED THIS SCRIPT IN ITS OWN SHELL."
exit 1
fi

View File

@ -1,2 +1,2 @@
#!/bin/bash
export PROMPT_COMMAND="$QASH_LIBRARY_DIR/deadline.check.sh; $PROMPT_COMMAND"
# export PROMPT_COMMAND="$QASH_LIBRARY_DIR/deadline.check.sh; $PROMPT_COMMAND"

View File

@ -1,14 +1,17 @@
#!/bin/bash
if [[ $# -lt 3 ]]; then
echo "Usage: getdt <from> <to> (format)"
return -1
exit 0
fi
from_date=$1
to_date=$2
format="%02d days, %02d:%02d:%02d"
if [[ $# -gt 3 ]]; then
format=$3
fi
target_epoch=$(date -d "$from_date" +%s)
now_epoch=$(date -d "$to_date" +%s)
remaining_seconds=$((target_epoch - now_epoch))
@ -19,3 +22,4 @@ minutes=$(((remaining_seconds % 3600) / 60))
seconds=$((remaining_seconds % 60))
printf "%02d days, %02d:%02d:%02d" $days $hours $minutes $seconds
exit 0