Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

BASH Scripts

Featured Replies

Post your useful BASH scripts here (Original only).

 

 

 

Umerge - For Gentoo Linux, unmerges multiple packages based on a keyword. I was disapointed that you couldn't use wildcards with emerge considering FreeBSD's Ports (Which are the role-model for portage) tools supported wildcards.

 

#!/bin/bash



keyword=$1



if [[ $1 = "" ]]

then echo "Please input the keyword to be mass unmerged:"

    read keyword

else :

fi



if [[ $keyword = "" ]]; then

       echo "You need to enter a keyword next time"

       exit

fi



ls -R /var/db/pkg/ | grep $keyword | sed 's/\/var\/db\/pkg\///g' | sed 's/://g' | sed 's/-r[0-9]$//g' | sed 's/\.//g' | sed 's/-[0-9]*$//g' | grep \/ | xargs emerge -pC





echo "These are the packages that I will unmerge. Are you sure you want

to go through with this? [y/n]:"



read var



if [ $var = "y" ]; then

       ls -R /var/db/pkg/ | grep $keyword | sed 's/\/var\/db\/pkg\///g' | sed 's/://g' | sed 's/-r[0-9]$//g' | sed 's/\.//g' | sed 's/-[0-9]*$//g' | grep \/ | xargs emerge -C

else

       echo "Sorry to hear that, maybe you should revise your keyword"

       exit

fi

 

 

 

Kernel updater [incomplete] -

 

Requires Lynx (Feel free to revise)

 

- Updates your kernel to the latest with git-sources patches. Incomplete, needs work. (Feel free to revise). It was distro-dependant but I never got to redoing it for compatibility with any distro. You can probably just wget the latest Linux version, wget the latest scripts, untar, patch, cp, oldconfig, compile, cp, sed some lines in bootloader configuration file.

 


#!/bin/bash



installed=`uname -r`

installed_ver=`echo $installed | cut -d- -f1 | awk -F "." '{ print $3 }'`

installed_rc=`echo $installed | awk -F "-" '{ print $2 }' | cut -c3-`

installed_git=`echo $installed | awk -F "git" '{ print $2 }'`



current=`lynx -dump http://www.kernel.org/kdist/finger_banner | grep git | awk '{ print $11 }'`

current_ver=`echo $current | cut -d- -f1 | awk -F "." '{ print $3 }'`

current_rc=`echo $current | awk -F "-" '{ print $2 }' | cut -c3-`

current_git=`echo $current | awk -F "git" '{ print $2 }'`



if [ "$installed_ver" -lt "$current_ver" ]; then upgrade="1"

elif [ "$installed_ver" -eq "$current_ver" ] && [ "$installed_rc" -lt "$current_rc" ]; then upgrade="1"

elif [ "$installed_ver" -eq "$current_ver" ] && [ "$installed_rc" -eq "$current_rc" ] \

 && [ "$installed_git" -lt "$current_git" ]; then upgrade="1"

fi



if [ -n "$upgrade" ]

then

   echo -e "Your kernel version is out of date\n"

   #To be done

fi



#debug

echo "Upgrade: $upgrade"

echo "Installed: $installed"

echo "Installed ver: $installed_ver"

echo "Installed rc: $installed_rc"

echo -e "Installed git: $installed_git\n"

echo "Current: $current"

echo "Current ver: $current_ver"

echo "Current rc: $current_rc"

echo "Current git: $current_git"

 

 

 

 

 

Yeah, I know, not much. I'm working on a few more but I'm already heavily into something else.

I havent really focused on BASH scripts, but if i get a chance i will post some i do use :)

yourmysin.jpeg

Current Goals

80/80 Fletching

60/75 Woodcutting

97/100 Combat

  • Author

I've recently been messing with a Linux Distrobution written completely in BASH (The utilities, that is) called Sourcemage. It's cool, and it reminded me that BASH is good for higher-level things aswell.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.