Collection of useful (perhaps transferrable with some modification) shell scripts for bash shell.
ccd is a sourced-necessary scripts which allows a user to search for a directory basename within n subdirectory levels from pwd. Usage exmaples include:
$ ccd Desktop 3 - searches for "Desktop" directories within 3 subdirectories. Will nto actually cd if not aliased ccd='. ccd' in ~/.bashrc
$. ccd Project1 - searches for "Project1" directories within a default of 5 subdirectories depth if no depth is passed in. Will cd as it is sourced
If only one directory is found, the shell automatically cd's into the directory if able to (currently cannot find directories with special characters or spaces in their names, and cannot use sudo).
If more than one directory matches, a list of possible choices is provided and the user is prompted to pick one to change to.
Whenever I plug my usb mouse dongle into my computer running ubuntu 20.04, my mouse settings reset to right-handed. Being left-handed, I wanted to automatically change this. I couldn't figure out visudo and the usr/udev/rules.d rules settings; however, by simply replacing $DEVICE_NAME with the name of your mouse usb (found via xinput -list), you can also easily change your primary button by running:
$ ms
It's just that easy. No need to source the script, either. Just add to ~/bin after placing your device in and go.
Upper is a script to provide the user with compliments provided in the associated compliments.txt file in the same /bin directory. Usage is simple:
$ upper
Calling upper will both echo the compliment to stdout and generate a system notification via zenity. Add more compliments as wanted to compliments.txt, and reset n to 1 at minimum.