Linux Blog

Remove all subversion .svn folders

Filed under: Quick Linux Tutorials,Shell Script Sundays — TheLinuxBlog.com at 2:30 am on Sunday, December 12, 2010

remove all subversion folders

This may be a no brainer for some of you elitists out there but if you need to (I don’t ask questions) remove all .svn folders within a project there is an easy way to do so. This would also work for other directories, but my main purpose for writing this is for .svn files / folders.

find . -iname ".svn" | xargs rm -r $1

I suppose you could also use svn export to get similar functionality, but if you’ve already checked out code, you wouldn’t want to waste precious internets and do it again would you?

Free DVD Ripper Software

Filed under: General Linux — TheLinuxBlog.com at 12:37 am on Wednesday, October 6, 2010

free dvd ripper software

So, you have a pesky DVD that you’d like to backup? The broader question is, do you have DVD ripper software? Well what is better than DVD ripping software? That’s right you guessed it FREE DVD ripper software!

(Read on …)

Backup your DVDs on Linux

Filed under: General Linux — TheLinuxBlog.com at 12:01 am on Wednesday, November 4, 2009

At an average of around $20 per DVD* most can’t afford to have any of their DVDs lost, stolen or broken. Backing them up is a touchy subject depending on who you talk to, but here is how to do it anyway.

Backing up a DVD on Linux used to be much harder than it is with K9Copy. No more flaky DVD Shrink crashes under wine. K9Copy takes the hassles out of creating backups of your DVDs under Linux. As the name implies it is KDE software but works well under gnome provided you have the needed libraries installed.

It has many options to backup and really is pretty comparable in functionality to the infamous DVD Shrink for Windows. Take a look at the screenshots and give it a try yourself:

* 2007 US Entertainment Industry Report (www.mpaa.org/USEntertainmentIndustryMarketStats.pdf)

Reworking Shell Scripts – Part 2

Filed under: Shell Script Sundays — TheLinuxBlog.com at 10:00 pm on Sunday, September 14, 2008

In the last Shell Script Sunday’s article I wrote, I said that I’d show you some more ways to rework shell scripts to make them easier to use. I’ve got some more tricks up my sleeve that I’d like to share, itsĀ  been rather busy this site of the internet at TheLinuxBlog.com. So why I write up some more shell scripting methods, here are some previous posts that can enhance your shell scripts. Be sure to comment on them if you find them useful, or would like more information.

Creating Dialogs with Dialog
If you have a shell script that you use on a regular basis, you may want to consider using dialog to make it more user friendly. Dialog makes it easy to create easy to use dialogs that are intuitive and easy to use. There are so many combinations of dialogs that can be created that the possibilities are ended. Dynamically create dialogs for select lists, input boxes, progress bars and much much more.

Graphical Shell Scripting
This article I wrote introduces graphical shell scripting. Similar to dialog this is an updated “Dialog” and works within X. If you support end users, or your target audience is Ubuntu/Linspire users (j/k) then XDialog may be the better choice. Its got most of the same functionality as Dialog except it depends on X. You can even support both Dialog and XDialog as they pretty much use the same syntax.

Bash Aliases

Filed under: General Linux,Linux Software,Quick Linux Tutorials — TheLinuxBlog.com at 12:23 pm on Wednesday, June 25, 2008

Have you ever wanted to make a command for something that did not exist? Perhaps modify the functionality of a particular application to something more suitable? I know I have. For example, and I know that there is probably a better way to do this, but on certain Linux machines (such as servers), I like to clear the output before exiting. While I can type the command:

 clear; exit

this still leaves me with a line at the top of the screen. Some distributions clear this automatically, for those that don’t an alias can be used.The basic principal for a bash alias is easy. You set an alias up and then use that alias instead of the command.
It appears that aliases have precedence over any already existing applications in the path so it becomes handy if you wish to override a command or perform a task before launching a built in command. I’m sure that this option can be changed if needed.

Now you know what aliases are here is how to use an alias to override the exit command in bash.

alias exit="clear; exit > /dev/null 2&> /dev/null"

Aliases with parameters can get tricky, the best workaround I have found is to write a shell script and put it in your local bin directory.

Eclipse – Around the World

Filed under: General Linux,Linux Software — TheLinuxBlog.com at 2:46 pm on Friday, June 6, 2008

Ganymede is coming! I’ve been using Eclipse for a little while now and would like to pass on some information about the Ganymede release.
In the past I have became accustomed to commercial IDE’s, what is bad about this is when a new release comes out often I’d have to either upgrade or be stuck with an old version. Eclipse gives me a standard development environment that works on multiple computer platforms. Through plug-ins often the exact same, or better functionality is added. What is great about Eclipse Ganymede is that it lets you get a preview of what the next generation of the IDE will look like. Eclipse Ganymede is not for every one, after all it is for testers and early adopters. Personally I like to download the Ganymede release every once in a while and test it out. After all some of the big players in the development industry sponsor or contribute to a number of projects that are based on eclipse and its nice to see what they are up to. Check out Ganymede Eclipse for yourself!

Using Bash Scripts in Web Applications

Filed under: Shell Script Sundays — TheLinuxBlog.com at 2:22 pm on Sunday, May 25, 2008

Using bash scripts for web applications is not exactly rocket science, nor is it necessarily the best idea in the world but it can be handy to do if you already have a bash script and want to use its functionality on the web. There are a couple of ways to use bash scripts on the web.

The first that I know of is as a CGI. All that you have to do for this one is create a cgi-bin or allow files with the extension .cgi to be executed this is done with apache in your httpd.conf file.

The Second is to use another scripting language to call the script. The easiest way for me is to use PHP. A system call to the script file can my made using the exec() function. Just make sure that the file has execute rights for the user that your web server runs as. Here is an example of using the exec() function in PHP:

$output = exec('/usr/local/bin/yourscript.sh');

The Third method is to use Server Side Includes to include the script. I personally am not familiar with setting up SSI’s but this is how you execute a command from within a SSI:

<!--#exec cmd="/usr/bin/date" -->

Which ever method you choose precautions have to be taken. Make sure that all inputs are sanitized so that a user cannot escape the command, pipe output to another file or manipulate the system in another way. In PHP it is easy to do this, but I can not speak for CGI’s or SSI’s. I hope this shows some insights as to how you can run bash scripts in your web application. If you have any other methods such as using mod_python or maybe tcl, please post them as a comment!

Select Statements in Bash

Filed under: Shell Script Sundays — TheLinuxBlog.com at 10:40 pm on Sunday, August 19, 2007

Shell scripts often need a menu so that the user can interact with the script and choose options. An easy way to so this is with the “select” statement.

Syntax:

select selection_var [in list]; do
statements (can use selection_var)
done

Example:

echo "########################################";
echo "#  SELECTS EXAMPLE - TheLinuxBlog.Com  #";
echo "########################################";
echo "#        Please Choose an Option       #";
echo "########################################";
 
select selection_var in Number_1 This_is_Choice_2 Exit; do
case $selection_var in
Number_1 )
echo "You picked $selection_var or #$REPLY"
;;
This_is_Choice_2 )
echo "You picked $selection_var or #$REPLY"
;;
Exit )
echo Goodbye!
break
;;
* )
echo "Invalid Selection"
;;
esac
done

This bash select example has three choices. The first two are just examples, the third exits the script. There is a fourth case but it is not a choice, it tells the user that they have entered an invalid selection. I recommend using a case inside of a select because it will make life easier when adding onto a script. The $REPLY variable is returned from the select statement as a means of knowing what number was pressed. The $REPLY variable can be used in the case statement but I avoid doing so as all of the case blocks will have to be rearranged every time a new option is added.

The select statement in bash is very easy to implement and it can add a whole new range of functionality into your scripts. So try them out and look out for them in future shell scripts from The Linux Blog.