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

8
install.sh Normal file → Executable file
View File

@ -22,12 +22,13 @@ if [[ $REPLY == 'y' ]]; then
mkdir -p "$dir/hooks" mkdir -p "$dir/hooks"
cp -r ./library/* $dir cp -r ./library/* $dir
cp -r ./library/hooks/* $dir/hooks/ cp -r ./library/hooks/* $dir/hooks/
chmod 744 -R $dir/
echo "Backing up old .bashrc..." echo "Backing up old .bashrc..."
i=0 i=0
while [[ -f ~/.bashrc.bak.$i ]] while [[ -f ~/.bashrc.bak.$i ]]
do do
i=$i + 1 i=$((i + 1))
done; done;
mv ~/.bashrc ~/.bashrc.bak.$i mv ~/.bashrc ~/.bashrc.bak.$i
@ -37,9 +38,10 @@ if [[ $REPLY == 'y' ]]; then
echo "# Installed on $(date -u +'%02d.%02m.%Y %02H:%02M:%02S')" >> ~/.bashrc echo "# Installed on $(date -u +'%02d.%02m.%Y %02H:%02M:%02S')" >> ~/.bashrc
echo "" >> ~/.bashrc echo "" >> ~/.bashrc
echo "source $QASH_LIBRARY_DIR/load.sh" >> ~/.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 exit 1
fi fi
echo "Installation cancelled." echo "Installation cancelled."
exit 1 exit 1

View File

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