Bash – Ubuntu bash scripting with root commands

bashrootscripting

I am trying to write a bash startup script in Ubuntu 9.04 that will remove the annoying system beep from my computer:

#/bin/bash

rmmod pcspkr #remove system beep; also doesnt work without root access

it keeps coming back when I start my computer back on, and I want to run a startup script to remove this annoyance. But I do not know how to run as root in bash scripting, does anyone know how to log on as root in bash scripting?

Best Answer

Add this to the end of /etc/modprobe.d/blacklist:

blacklist pcspkr

This will prevent the pc speaker module from being loaded when you start the computer.