bash files

Asked by Brad Ganson

have created a bash file to update alsa _.0.21 to alsa_1.0.23 for Ubuntu 10.04.
why...after i run it as executable with ./ in terminal mode is the file erased. i wrote it with gedit and saved to /home.
and how can I attach it here so everyone can use it if they need to upgrade to latest sound driver.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu bash Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#1

To get better help please send here the script content...

Revision history for this message
Brad Ganson (bganson) said :
#2

how do I send it?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Just paste the text.

Should only really be one line:

sudo add-apt-repository ppa:ricotz/unstable; sudo apt-get update; sudo apt-get upgrade

Done

Revision history for this message
Brad Ganson (bganson) said :
#4

#!/bin/bash
STRING="Restart your computer to affect changes. Type cat /proc/asound/version to confirm changes."
cat /proc/asound/version
sudo /sbin/alsa-utils stop
sudo apt-get -y install build-essential ncurses-dev gettext xmlto libasound2-dev
sudo apt-get -y install linux-headers-`uname -r` libncursesw5-dev
cd ~
rm -rf ~/alsa* ~/.pulse*
wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.23.tar.bz2
wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.23.tar.bz2
wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.23.tar.bz2
sudo rm -rf /usr/src/alsa
sudo mkdir -p /usr/src/alsa
cd /usr/src/alsa
sudo cp ~/alsa* .
sudo tar xjf alsa-driver*
sudo tar xjf alsa-lib*
sudo tar xjf alsa-utils*
cd alsa-driver*
sudo ./configure
sudo make
sudo make install
cd ../alsa-lib*
sudo ./configure
sudo make
sudo make install
cd ../alsa-utils*
sudo ./configure
sudo make
sudo make install
rm -f ~/alsa-driver*
rm -f ~/alsa-lib*
rm -f ~/alsa-utils*
echo $STRING
exit

Revision history for this message
PeterPall (peterpall) said :
#5

Try to change the

rm -rf ~/alsa* ~/.pulse*

to

rm -rf ~/.alsa/* ~/.pulse/*
rmdir .alsa .pulse

or to

rm -rf ~/.alsa ~/.pulse

Prior to this change if your script begins wirh "alsa" it will match the pattern "¸/alsa*", which should be the source of the problem.
Did a similar thing once in a script that was supposed to be a backup application.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

The f isn't needed.

rm -r

is quite sufficient.

Revision history for this message
Brad Ganson (bganson) said :
#7

i saw these instructions at the following website:
http://monespaceperso.org/blog-en/2010/05/02/upgrade-alsa-1-0-23-on-ubuntu-lucid-lynx-10-04/
rm -rf ~/alsa* ~/.pulse*
i presume means delete all files with the name alsa from my root directory.
if that is true what does rm -r mean?

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#8

rm will delete a file only, or empty a folder.
rm -r is a recursive delete and will basically delete the folder too.
rm -f will FORCEFULLY delete the folder and ca cause issues if files in the folder are open. If you know the files are not used then -f is not needed and using -f as a normal option is a REALLY *BAD* habit to form.

Force should only be used when needed, not every time.

Revision history for this message
Brad Ganson (bganson) said :
#9

Thanks actionparsnip, that solved my question.