Skip to content

Instantly share code, notes, and snippets.

@Max95Cohen
Last active February 26, 2024 03:59
Show Gist options
  • Save Max95Cohen/91e2fac00fed56f651c5ba82c4062049 to your computer and use it in GitHub Desktop.
Save Max95Cohen/91e2fac00fed56f651c5ba82c4062049 to your computer and use it in GitHub Desktop.
bash files
#!/bin/sh
nocolor='33[0m';
color0='33[0;30m';
color1='33[0;31m';
color2='33[0;32m';
color3='33[0;33m';
color4='33[0;34m';
color5='33[0;35m';
color6='33[0;36m';
color7='33[0;37m';
color10='33[1;30m';
color11='33[1;31m';
color12='33[1;32m';
color13='33[1;33m';
color14='33[1;34m';
color15='33[1;35m';
color16='33[1;36m';
color17='33[1;37m';
printf "${color0}Hello${color1}, ${color2}how ${color3}are ${color4}you? ${color5}I ${color6}am"
printf " ${color7}fine, ${nocolor}thanks! ${color10}And ${color11}you? ${color12}I ${color13}am"
printf " ${color14}fine, ${color15}too! ${color16}Test ${color17}Pestn"
#!/bin/sh
a=$(date +%s)
cp -frv -T "/home/bilimbox/Desktop/BilimDesk/" "/media/bilimbox/BilimBox$1/"
b=$(date +%s)
c=`expr $b - 100`
date -d @$c
#!/bin/sh
case $1 in
"") disk="sdb";;
"1") disk="sdc";;
"2") disk="sdd";;
"3") disk="sde";;
"4") disk="sdf";;
esac
a=$(ls /dev/${disk} 2>&1)
if [[ $a == *"No such file or directory"* ]]; then
echo "NO SUCK DISK $disk"
echo "ERROR. EXIT"
exit 0
fi
echo "CHOOSED DISK: $disk"
echo "UNMOUNT DISK ${disk}1"
umount /dev/${disk}1
echo "UNMOUNT DISK ${disk}2"
umount /dev/${disk}2
echo "REMOVE ALL PARTITIONS"
parted -s /dev/${disk} rm 1
parted -s /dev/${disk} rm 2
echo "CREATE NEW PARTITIONS"
parted -s /dev/${disk} mkpart primary ntfs 1MB 106MB
parted -s /dev/${disk} mkpart primary ntfs 106MB 100%
echo "UNMOUNT ALL DISKS"
umount /dev/${disk}1
umount /dev/${disk}2
b=1;
while [[ $b == 1 ]]; do
a=$(mkfs.ntfs -L "BilimDesk-Data" -Q /dev/${disk}1 2>&1)
if [[ $a == *"Failed"* ]]; then
b=1;
else
echo "FORMAT PARTITION 1 SUCCESS"
b=0;
fi
sleep 1;
done
b=1;
while [[ $b == 1 ]]; do
a=$(mkfs.ntfs -L BilimDesk -Q /dev/${disk}2 2>&1)
if [[ $a == *"Failed"* ]]; then
b=1;
else
echo "FORMAT PARTITION 2 SUCCESS"
b=0;
fi
sleep 1;
done
user="how-are-you"
echo "CREATING TEMPORARY DIRECTORIES"
a=$(ls "/media/$user/BilimDesk$1" 2>&1)
if [[ $a == *"cannot"* ]]; then
mkdir "/media/$user/BilimDesk$1"
fi
echo "SUCESS: BilimDesk-Data$1"
a=$(ls "/media/$user/BilimDesk-Data$1" 2>&1)
if [[ $a == *"cannot"* ]]; then
mkdir "/media/$user/BilimDesk-Data$1"
fi
echo "SUCESS: BilimDesk$1"
echo "MOUNTING DISKS"
mount /dev/${disk}1 "/media/$user/BilimDesk-Data$1"
mount /dev/${disk}2 "/media/$user/BilimDesk$1"
echo "===== COPY =============================================="
echo "FROM: /home/$user/Desktop/BilimDesk/"
echo "TO: /media/$user/BilimDesk$1/"
echo "===== COPY =============================================="
echo "Press ENTER to start..."
read ready
start=$(date)
cp -frv -T "/home/$user/Desktop/BilimDesk/" "/media/$user/BilimDesk$1/"
echo $start
end=$(date)
echo $end
du -d 0 "/media/$user/BilimDesk-Data$1"
du -d 0 "/media/$user/BilimDesk$1"
umount /dev/${disk}1
umount /dev/${disk}2
rmdir "/media/$user/BilimDesk-Data$1"
rmdir "/media/$user/BilimDesk$1"
for i in "$(ls -1)"; do
s=$(echo "$i" | sed "s/\.mp4/\.mp3/")
echo "$s";
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment