Loading...
More Shell Posts
#!/bin/bash#Installs the Vulkan library and other goodies. Works on Arch and Arch based distros. Needs pacman and makepkginstallVulkan(){#Tries installing every linux package in existencepackages=( vulkan-tools libvulkan-dev vulkan-loader-devel vulkan-validation-layers spirv-tools mesa-vulkan-devel vulkan-validation-layers-devel )for package in ${packages[*]}; dosudo pacman --noconfirm -S $packagedone}installLibraries(){#All of these packages don't exist, so we have to download and install the AUR packages#packages=( libglfw3-dev glfw-devel libglm glm-devel )#for package in ${packages[*]}; do# sudo pacman --noconfirm -S $package#donesudo git clone https://aur.archlinux.org/glfw-git.git /tmp/glfw-gitsudo chmod 777 /tmp/glfw-gitcd /tmp/glfw-gitmakepkg -sisudo git clone https://aur.archlinux.org/glm-git.git /tmp/glm-gitsudo chmod 777 /tmp/glm-gitcd /tmp/glm-gitmakepkg -si}installShaderCompiler(){#Basically installs glslcsudo pacman -S shaderc}while true; doselect bruh in installVulkan installLibraries installShaderCompiler "exit"; do$bruhdonedone
#!/bin/bashgit statusecho "Do you want to add all changed files?"select yn in "Yes" "No"; docase $yn inYes ) break;;No ) exit 1;;esacdonegit add -ugit statusecho "Does this look right?"select yn in "Yes" "No"; docase $yn inYes ) break;;No ) exit 2;;esacdonegit commitecho "Do you want to push?"select yn in "Yes" "No"; docase $yn inYes ) break;;No ) exit 2;;esacdonegit push
#diskRipper.sh by Leif Messinger#For use on debian, where your cds aren't immediately mountedwall "CD inserted boss"set -x #echo oncdDrivePath=$(ls -l /dev/cdrom | awk '{print $NF}')#CD could have no label, so that's why I need awkcdLabel=$(lsblk -n "/dev/$cdDrivePath" -o label)if [[ ! -z "$cdLabel" ]]; then #CD has labelfolderName=$cdLabelecho "The cd label is ${folderName}"if mkdir ./cds/"${folderName}"; then #Folder didn't exist beforesudo mount /dev/cdrom ./.cdmountpointsudo cp -r ./.cdmountpoint/* "./cds/${folderName}"sudo chmod -R 777 "./cds/${folderName}"sudo umount ./.cdmountpointejectwall "CD done and ejecting"elsewall "Already read that cd, skipped"fielsewall "CD had no label, skipped"fi
name="John"echo ${name}echo ${name/J/j} #=> "john" (substitution)echo ${name:0:2} #=> "Jo" (slicing)echo ${name::2} #=> "Jo" (slicing)echo ${name::-1} #=> "Joh" (slicing)echo ${name:(-1)} #=> "n" (slicing from right)echo ${name:(-2):1} #=> "h" (slicing from right)echo ${food:-Cake} #=> $food or "Cake"
# Three ways of checking if a file exists in a shell scriptFILE=/etc/resolv.confif test -f "$FILE"; thenecho "$FILE exists."fiif [ -f "$FILE" ]; thenecho "$FILE exists."fiif [[ -f "$FILE" ]]; thenecho "$FILE exists."fi
#!/bin/bashfor branch in $(git branch | cut -c 3-); doread -p "Delete local branch $branch? (y/n) " -n 1 -recho ""if [[ $REPLY =~ ^[Yy]$ ]]; thengit branch -D $branchfidone